Solved How to promote the PropertyAnination as one property?
-
property PropertyAnimation id: windowEnterAnimation; PropertyAnimation { id:windowEnterAnimation; target: borderItem; duration: 500; property: 'opacity'; to: 1; }
The code up is in one QML file. Now, I want to call "windowEnterAnimation" in another QML file. The result shows as following:
qrc:/main.qml:304: TypeError: Cannot call method 'start' of undefined.
Why? Could anyone help me? Thanks in advance!
-
@small_bird said in How to promote the PropertyAnination as one property?:
qrc:/main.qml:304: TypeError: Cannot call method 'start' of undefined.
Can you put minimal code of main.qml?
-
said in How to promote the PropertyAnination as one property?:
property PropertyAnimation id: windowEnterAnimation;
Just as a guess:
property alias propertyAnimation : windowEnterAnimation;
-
Loader{ id:imageSequencePlayWindowLoader; asynchronous: true; } ButtonComponent{ id:cancelButton; anchors.right: parent.right; anchors.bottom: parent.bottom; anchors.bottomMargin: 10; anchors.rightMargin: 20; Image { anchors.centerIn: parent; source: "qrc:/uiElements/cancelMark.png"; } source: focus ? "qrc:/uiElements/buttonFocused.png" : "qrc:/uiElements/buttonNormal.png"; mouseArea.acceptedButtons: Qt.LeftButton; mouseArea.onClicked: { windowExitAnimation.start(); processedImageWindowLoader.item.propertyAnimation.start(); } }
-
This post is deleted! -
@6thC Thanks a lot! It works.
-
- You have to create an object of windowEnterAnimation component in the main.qml
- Then, you can reference windowEnterAnimation.start() from the object that you created.
What is "imageSequencePlayWindowLoader" Loader for? And, what does "processedImageWindowLoader" for?
-
@small_bird That's cool. You can share the solution here, it would help others.