I'm using create js to convert flash object into javascript. I want to use a function in the object's timeline when the stage is created, but this function doesn't exist when i call it. How to know when the object is fully added on stage ?
var button = new lib.objCreateJs();
stage_createJs.addChild(button);
button.move(); // return " Uncaught TypeError: Object [object Object] has no method 'move' "
part my object :
(function (lib, img, cjs) {
var p; // shortcut to reference prototypes
// stage content:
(lib.objCreateJs = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{})
// timeline functions:
this.frame_0 = function() {
this.move = function()
{
this.mcBouge.gotoAndStop("move");
}
}
I got the answer : the stage must be updated (stage.update(); ) when an object is added.