Question

I have "Question.swf", which was created from "Question.fla". Note that Question.fla has no Document Class associated with it. (Note that this is legacy content, and there are over 14,000 variants of "Question.swf"; changing all these is not a viable option.)

Now I have my main Flash application, which loads in Question.swf at runtime. I know that Question.swf has a "Document Class" automatically created which represents the entire "stage" of the SWF (and that it's named "MainTimeline"). I want this application to be able to instantiate multiple instances of that Question.swf Document class... how can I?

I've been working with Flash/AS3 since 2006 (I'm very familiar with loading/using external content, the ApplicationDomain, etc.), but I find that I have no idea how to do this!

Things I've tried which haven't worked include querying the relevant ApplicationDomain with hasDefinition( "Question_fla.MainTimeline" ) - this returns false - as well as running getQualifiedClassName() on my loader.content object - this just returns MovieClip.

Was it helpful?

Solution

I'm not sure how to duplicate the main content of the Loader. However, a reasonable workaround might be to load the SWF bytes once and create multiple Loaders from those bytes:

  1. Load your SWF bytes with a URLLoader:

    var urlloader : URLLoader = new URLLoader();
    urlloader.load(new URLRequest("your url here"));
    
  2. Once it is loaded, use the bytes to instantiate new display objects:

    var loader : Loader = new Loader();
    loader.loadBytes(urlloader.bytes);
    
  3. Use your loaded loader's loader.content display object on the display list (or the loader itself).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top