Actually I have this code :
import "class1"
import "class2"
Item {
id: myItem
property variant myVar: 0;
anchors.fill: parent;
Component {
id: compClass1
class1 { id: class1ID
anchors.fill: myItem;
}
}
Component {
id: compClass2
class2 {
anchors.fill: myItem;
}
}
Loader { id: myLoader }
function update() {
switch(myID.myVar) {
case 0:
myLoader.sourceComponent = compClass1;
classID.myFunction();
break;
case 1:
myLoader.sourceComponent = compClass2;
break;
}
}
The problem when I want to call a function, I get an error :
TypeError: Result of expression 'class1ID.myFunction' [undefined] is not a function.
P.S : the class class1
have already a function called myFunction()