positioning a mc with onLoadComplete
Hi,
I'm loading a swf into an mc on the stage. After it's loaded I want to center it on stage. I'm doing something like this:
Code:
maintimeline = this;
mainMC.onResize = function() {
this._x = (Stage.width+this._width)/4;
this._y = (Stage.height+this._height)/4;
};
Stage.addListener(mainMC);
maintimeline.mainMC.onResize();
//
var mainMCloader = new MovieClipLoader();
mainMClistener = new Object();
mainMClistener.onLoadComplete = function() {
updateAfterEvent;
maintimeline.mainMC.onResize();
};
mainMCloader.addListener(mainMClistener);
mainMCloader.loadClip("main.swf", maintimeline.mainMC);
The problem is that, even while I'm using onLoadComplete, Flash thinks that the mainMC._width = 0. It is only, when I make the timeline play a couple of frames that mainMC._width finally results in the real size (the one of the loaded swf).
What I'm I doing wrong???
Cheers