Skip to main content
Known Participant
December 19, 2009
Question

Cross using of MovieClips and externally constructed MovieClips in 2 SWF-Files

  • December 19, 2009
  • 1 reply
  • 467 views

Hello, I have two SWF-Movies. One is exported into eht other as Child.

Can I instance the Objects of the two libraries in all places, where ActionScript is possible? (In Keyframes of the MovieClips and in external class definitions.)

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
December 19, 2009

you have 2 swfs and one "loads" the other?

and, you want to use the items exported for actionscript in both libraries?

if yes and yes, then yes, you can instantiate items in both libraries using the applicationdomain of the loaded swf to reference the objects in its library.

kraöAuthor
Known Participant
December 19, 2009

What is the applicationdomain? The Document class or simply the filename?

kglad
Community Expert
Community Expert
December 19, 2009

the applicationdomain holds the classes from loaded swfs.  you should read the flash help files.

but, if you wanted to create an instance of the class C1 that's defined in swf2.swf and, you're loading swf2.swf, you could use:

var ldr:Loader = new Loader();
var urlR:URLRequest = new URLRequest("swf2.swf");
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,f);

var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
ldr.load(urlR,loaderContext);

function f(e:Event){
    var C:Class = Class(ApplicationDomain.currentDomain.getDefinition("C1"));
    var c1:* = new C();
}