I’m currently making a game called Snowflake to learn how to program QML with Javascript.
- I have my sourcecode here: https://gist.github.com/4510190.
The only files i got besides that is a default qmlproject file and a png file.
I have made this timer(Timer) and a rectangle(skullflake) which it should spawn for every interval it has finished.
Timer { //spawnrate
interval: 2000; running: true; repeat: true
onTriggered: Qt.createQmlObject(skullflake)
}
But when I try to run it, it gives me the error:
file:///where/the/project/is/saved/Snowflake/Snowflake.qml:21: Error: Qt.createQmlObject(): Invalid arguments
I have tried with both these elements but I can’t seem to make it work
Qt.createComponent(skullflake)
Qt.createQmlObject(skullflake)
You were using wrong Qt.createQmlComponent().
It requires 3 parameters:
So it should look like something like this (parent should be id of element which should contain skullflake):