-
-
Save boorik/7e370a301f06340e2832f615a0b6d3a6 to your computer and use it in GitHub Desktop.
working with swf lib 2.1.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package; | |
import flash.display.Loader; | |
import flash.events.Event; | |
import openfl.display.LoaderInfo; | |
import openfl.display.Sprite; | |
import openfl.Lib; | |
import openfl.events.IOErrorEvent; | |
import openfl.net.URLLoader; | |
import openfl.net.URLLoaderDataFormat; | |
import openfl.utils.ByteArray; | |
class Main extends Sprite | |
{ | |
public function new() | |
{ | |
super(); | |
var l = new openfl.net.URLLoader(); | |
l.dataFormat = URLLoaderDataFormat.BINARY; | |
l.addEventListener(Event.COMPLETE, show); | |
l.addEventListener(IOErrorEvent.IO_ERROR, error); | |
l.addEventListener(openfl.events.SecurityErrorEvent.SECURITY_ERROR, error); | |
l.load(new openfl.net.URLRequest("http://01static.sfs.chapatiz.com/fr/swf/new_lib/converted_18040.swf")); | |
} | |
private function error(e:Event):Void | |
{ | |
throw(e); | |
} | |
private function show(e:Event):Void | |
{ | |
var swf = new format.SWF(cast(cast(e.target, URLLoader).data, ByteArray)); | |
var c = swf.createMovieClip("Inactive"); | |
c.x = 200; | |
c.y = 200; | |
addChild(c); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment