1

Is there a way I can load a swf file but not automatically instantiate it's DocumentClass?

Instead I want to do something like the following:

protected function mainLoaded(e:Event = null):void {
  trace('mainLoaded');
  var main:* = this.mainLoad.createClassByName('Main');
  trace(main);
}

where mainLoad is an instance of CasaLib's SwfLoad and createClassByName is the equivalent to loaderInfo.applicationDomain.getDefinition();

The thing is that when my swf finishes loading I can see it is created, because of some trace calls, although its obviously not added to the display list.

Marcel M.
  • 2,376
  • 2
  • 18
  • 24

1 Answers1

1

In your child swf's document class, use the following:

//constructor
public function ChildSWF()
{
    if(stage) init()
    else addEventListener(Event.ADDED_TO_STAGE, init);

}// end if

private function init(e:Event = null):void
{
    removeEventListener(Event.ADDED_TO_STAGE, init);
    trace("This will only trace when an instance of ChildSWF is added to the stage, not when it's instantiated");

}// end function
Taurayi
  • 3,209
  • 2
  • 17
  • 15