Modern addiction: ActionScript 3.0 Chit chat about AS 3.0, OO concepts, and Flash in general…

26Jul/090

Enable stage object in loaded SWF

Suppose you load some SWF in your main SWF, and you want it to have access to main's stage. In Document Class of loaded SWF you should add:

public function LoadedSWFConstructo() {
  this.addEventListener( Event.ADDED_TO_STAGE, init );
}
 
public function init( event:Event ):void {
  trace( stage.quality );
}

So, in loaded SWF constructor you would register for ADDED_TO_STAGE event, and then you can use stage object. Simple enough.

Why do you need this? Mostly when having your application in full browser window. When resizing occurs you would want to resize or move objects in you loaded SWF. Imagination is the limit. :-)

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.