Create a gist now

Instantly share code, notes, and snippets.

package com.illuzor.test {
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
public class Main extends Sprite {
public function Main():void {
var loader:Loader = new Loader();
loader.load(new URLRequest("TestToLoad.swf"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
}
private function onLoaded(e:Event):void {
e.target.removeEventListener(Event.COMPLETE, onLoaded);
var TestClass:Class = e.target.applicationDomain.getDefinition("com.illuzor.test.LoadedClass") as Class;
var loadedClassInstance:ITest = new TestClass() as ITest;
trace(loadedClassInstance.getTestNumber());
trace(loadedClassInstance.getTestText());
trace(loadedClassInstance.testGetterVar);
}
}
}
package com.illuzor.test {
public interface ITest {
function getTestText():String;
function getTestNumber():Number;
function get testGetterVar():String;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment