Skip to content

Instantly share code, notes, and snippets.

@honzabrecka
Last active August 29, 2015 14:06
Show Gist options
  • Save honzabrecka/910c45a69d1d099fe158 to your computer and use it in GitHub Desktop.
Save honzabrecka/910c45a69d1d099fe158 to your computer and use it in GitHub Desktop.
stop();
var loaderListener:Object = new Object();
loaderListener.onLoadInit = function(swf:MovieClip):Void
{
//for (var p in swf) trace(swf[p]);
channel.send("as3bridge", "loaded");
};
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(loaderListener);
var channel:LocalConnection = new LocalConnection();
channel.connect("as2bridge");
channel.loadFile = function(file:String):Void
{
loader.loadClip(file, container_mc);
};
channel.dispose = function():Void
{
loader.unloadClip(container_mc);
channel.close();
};
var client:Object = {};
client.loaded = function():void
{
trace("loaded, stage size=[" + swf.width + ";" + swf.height + "]");
exportImage(name);
channel.send("as2bridge", "dispose");
done();
};
client.textElement = function(x:uint, y:uint, width:uint, height:uint):void
{
metadata = {x: x, y: y, width: width, height: height};
exportMetadata();
}
channel = new LocalConnection();
channel.client = client;
channel.connect("as3bridge");
channel.addEventListener(StatusEvent.STATUS, channel_statusHandler);
setTimeout(function():void
{
channel.send("as2bridge", "loadFile", path.replace(/\\/g, "/"));
}, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment