I mean on the Main class file:
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
}
Can’t you just go straight in with what will run once the SWF fully loads or do you need this little bit of code?
The point is that your not sure if the stage exists, so you cannot safely
this.stageinside the constructor. Its more safe to wait till added to stage, especially when that swf is loaded from another swf. You can remove the listener, but its not much overhead, since its removed when added, so its a one trick pony.