It seems to be very easy, but it gave me all kinds of headaches. I have a movie clip, which is a gallery. It is associated with a call from AS when a button is pressed. When an image in the gallery is clicked, it disappears using the Tween class and should be focused on the main scene, but instead, it focuses on the movieClip.
Here is the code:
function fullLoaded(e:Event):void {
var myFull:Loader = Loader(e.target.loader);
addChild(myFull);
myFull.x = (stage.stageWidth - myFull.width) / 2;
myFull.y = (stage.stageHeight - myFull.height) /2;
myFull.addEventListener(MouseEvent.CLICK, removeFull);
new Tween(myFull, "alpha", Strong.easeInOut,0,1,0.5,true);
}
I tried all these combinations to no avail:
MovieClip(root).stage.stageWidth
root.stage.stageWidth
parent.stage.stageWidth
None of them put the image in the right place.
source
share