0

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.

IQpierce
  • 501
  • 2
  • 8
  • 17
  • Not sure to understand well, but as far as I know, the document class of a loaded SWF is automatically instanciated on load. – RafH May 08 '13 at 22:49
  • This is correct, but I'd like to instantiate a SECOND instance of that class. (And a third, and a fourth.) I had assumed that my loader.content object was an instance of this class, but if it is, neither getQualifiedClassName() or describeType() acknowledge that (they both report it's a MovieClip). – IQpierce May 08 '13 at 22:51

1 Answers1

1

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).

John Watson
  • 106
  • 2
  • This seems to be the closest possible way to do what I want - it's strange that there's no other way to instantiate this class though. Thanks John! – IQpierce Jun 06 '13 at 18:11