Skip to content

Instantly share code, notes, and snippets.

@trxcllnt
Created April 7, 2010 20:03
Show Gist options
  • Save trxcllnt/359366 to your computer and use it in GitHub Desktop.
Save trxcllnt/359366 to your computer and use it in GitHub Desktop.
override protected function initializeApplication():void
{
// Try to initialize mixins to the ReflexApplicationLoader
// (a well behaved mixin relies on a MovieClip),
// but if anything goes wrong, don't allow mixins to muck
// up our initialization.
var mixins:Array = info()["mixins"];
if(mixins && mixins.length > 0)
{
while(mixins.length > 0)
{
try{
getDefinitionByName(mixins.pop())["init"](this);
}
catch(e:Error){/* Fall through */}
}
}
// Cast with 'as' because create() can possibly return 'null',
// and casting 'null' to a DisplayObject will throw an error
var app:DisplayObject = create() as DisplayObject;
// If there's no app, this is probably an app made in Flash Pro,
// in which case moving to the second frame is sufficient action
// on our part.
if(!app)
{
return;
}
//The Application should listen for its own added_to_stage
//event and initialize itself from that.
addChild(app);
super.initializeApplication();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment