views:

16

answers:

2

I am loading a MovieClip using MovieClipLoader. When the MovieClip starts playing, it changes the alignment of my stage to LT, which incorrectly repositions all the other objects on my stage.

Is there anyway for me to:

  1. Prevent the MovieClip from changing the alignment of my stage?
  2. Adding an event handler to an appropriate event, so that I can reset the stage alignment when it gets changed?

I have already tried resetting the stage alignment on the onLoadInit event of MovieClipLoader and the onEnterFrame event of MovieClip, but both seem to reset the alignment too soon.

A: 

Try setting _lockroot = true on the offending clip once you've loaded it, this may keep it from messing with your stage.

http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00001321.html

grapefrukt
A: 

I tried to set _lockroot = true in the onLoadComplete event handler of my MovieClipLoader, but this did not solve the problem. My event handler is as follows:

lLoadListener.onLoadComplete = function(target_mc:MovieClip)
{
    Debug.info("lockroot is " + target_mc._lockroot);
    target_mc._lockroot = true;
    Debug.info("lockroot is " + target_mc._lockroot);
}

But this just prints lockroot is undefined twice. I have also tried to add _lockroot = true to the onLoad event handler of the MovieClip I am loading, but after some investigation and debug trace, it seems that the onLoad event is never being called.

Is there any reason why target_mc._lockroot should be returning undefined? Is it related at all to onLoad ever being called?