Copy link to clipboard
Copied
Hello, I access the method of a movieClip that has the name 'testMc' in the linkage, using this code :
var tst = new lib.testMc();
tst.testversion();
this code is in the first frame of the 'testMc' movie clip :
function testversion(){
console.log('from mc new version !!!!!!!!!!!!!!!!');
}
this .testversion =testversion ;
I get this error after updating to a new createjs version 1.0.0
Uncaught TypeError: this .testversion is not a function
at a.b._dispatchEvent (createjs.min.js:12)
at a.b._dispatchEvent (createjs.min.js:12)
at a.b.dispatchEvent (createjs.min.js:12)
you have, at least, 3 errors.
1. there shouldn't be a space between this and .testversion
2. testMc's timeline won't "run" unless it's added to the display. ie, it's code won't execute
3. after it is added, there's a delay before it's first frame plays.
use:
var tst = new lib.testMc();
this.addChild(tst);
setTimeout(f,300);
function f(){
tst.testversion();
// you can remove tst if it's not needed on stage.
}
Copy link to clipboard
Copied
you have, at least, 3 errors.
1. there shouldn't be a space between this and .testversion
2. testMc's timeline won't "run" unless it's added to the display. ie, it's code won't execute
3. after it is added, there's a delay before it's first frame plays.
use:
var tst = new lib.testMc();
this.addChild(tst);
setTimeout(f,300);
function f(){
tst.testversion();
// you can remove tst if it's not needed on stage.
}
Copy link to clipboard
Copied
Thanks for your reply, in the original code there is no space after 'this' keyword and the movieClip was added to a container =), and you are right the setTimeout() resolves the problem.
After the update to createjs 1.0.0 , I notice also that the method : stage.on("drawstart", functions, this, true)
don't work and I have to replace it with setTimeout().
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now