Loaded SWF not executing as expected? (AS3)

A best practices way of loading a SWF withing another SWF is

        public function Constructor() {
            if (stage == null)        {
                addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);

        private function onAddedToStage(event:Event = null):void{
private function init(){
//typical constructor code

The problem with putting some types of code in the constructor is that the SWF may not yet be added to the Display tree, and stage-aware code will return nulls and errors. So, if an application works on the desktop but not on the test server when loading nested SWFs, have a look at this possibility.

A good description is here:



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s