Skip to main content
Participant
July 25, 2014
Question

How to embed an actionscript code library into a swf and access in another swf? (bootstrap)

  • July 25, 2014
  • 1 reply
  • 301 views

Basically I want to have the library function of a swc, but the remote loading feature of a swf.

I have a code library which I'm embeding into a swf. All classes and methods no graphical or text elements. After the code is embedded into a swf, I'd like to remotely access this swf from another swf. So swf A contains the classes and it is loaded into swf B is just a shell and uses the methods/classes from swf A as if they were at the root of B.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
July 26, 2014

here's one way to load a swf that contains a class that shows how to instantiate that class:

var l:Loader = new Loader();

var s:String = "C";

load1("test.swf");

function load1(urlS:String) {

    l.contentLoaderInfo.addEventListener(Event.COMPLETE, f);

    l.load(new URLRequest(urlS), new LoaderContext(false, ApplicationDomain.currentDomain));

}

function f(event:Event):void{

    var c:Class = Class(getDefinitionByName(s));

    var instance:* = new C();

}