diff --git a/libsrc/ffdec_lib/testdata/as3_harman/bin/harman.swf b/libsrc/ffdec_lib/testdata/as3_harman/bin/harman.swf new file mode 100644 index 000000000..96f740c84 Binary files /dev/null and b/libsrc/ffdec_lib/testdata/as3_harman/bin/harman.swf differ diff --git a/libsrc/ffdec_lib/testdata/as3_harman/bin/harman.xml b/libsrc/ffdec_lib/testdata/as3_harman/bin/harman.xml new file mode 100644 index 000000000..e569d68a7 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_harman/bin/harman.xml @@ -0,0 +1,29 @@ + + + + com.jpexs.Harman + 1.0 + Harman + + Harman + + JPEXS + + + Harman + harman_encrypted.swf + standard + false + true + true + true + true + 800 + 600 + + + + diff --git a/libsrc/ffdec_lib/testdata/as3_harman/bin/harman_encrypted.swf b/libsrc/ffdec_lib/testdata/as3_harman/bin/harman_encrypted.swf new file mode 100644 index 000000000..167b09b63 Binary files /dev/null and b/libsrc/ffdec_lib/testdata/as3_harman/bin/harman_encrypted.swf differ diff --git a/libsrc/ffdec_lib/testdata/as3_harman/bin/inside.swf b/libsrc/ffdec_lib/testdata/as3_harman/bin/inside.swf new file mode 100644 index 000000000..5ea7ac3dc Binary files /dev/null and b/libsrc/ffdec_lib/testdata/as3_harman/bin/inside.swf differ diff --git a/libsrc/ffdec_lib/testdata/as3_harman/build_harman_debug.bat b/libsrc/ffdec_lib/testdata/as3_harman/build_harman_debug.bat new file mode 100644 index 000000000..accb926e5 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_harman/build_harman_debug.bat @@ -0,0 +1,6 @@ +@echo off +set MY_PATH=%~dp0 +call c:\air_harman\bin\mxmlc.bat -debug=true -output bin/harman.swf src/Main.as 1> buildlog.harman.txt 2>&1 +cd c:\air_harman\bin\ +call swfencrypt.bat -in %MY_PATH%\bin\harman.swf -out %MY_PATH%\bin\harman_encrypted.swf + diff --git a/libsrc/ffdec_lib/testdata/as3_harman/run.bat b/libsrc/ffdec_lib/testdata/as3_harman/run.bat new file mode 100644 index 000000000..a6983fbbd --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_harman/run.bat @@ -0,0 +1,2 @@ +@echo off +c:\air_harman\bin\adl.exe -nodebug %~dp0\bin\harman.xml diff --git a/libsrc/ffdec_lib/testdata/as3_harman/src/EncryptedByteArray.as b/libsrc/ffdec_lib/testdata/as3_harman/src/EncryptedByteArray.as new file mode 100644 index 000000000..418e402bf --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_harman/src/EncryptedByteArray.as @@ -0,0 +1,7 @@ +package { + import flash.utils.ByteArray; + + [Embed(source="/../bin/inside.swf", mimeType="application/octet-stream", encrypted="true")] + public class EncryptedByteArray extends ByteArray { + } +} diff --git a/libsrc/ffdec_lib/testdata/as3_harman/src/Main.as b/libsrc/ffdec_lib/testdata/as3_harman/src/Main.as new file mode 100644 index 000000000..ade465173 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_harman/src/Main.as @@ -0,0 +1,57 @@ +package +{ + import flash.display.Sprite; + import flash.events.Event; + import flash.utils.ByteArray; + import flash.system.System; + import flash.display.Loader; + import flash.display.StageAlign; + import flash.display.StageScaleMode; + import flash.system.LoaderContext; + import flash.system.ApplicationDomain; + + public class Main extends Sprite + { + + private var swfLoader: Loader; + + public function Main():void + { + if (stage) { + init(); + } else { + addEventListener(Event.ADDED_TO_STAGE, init); + } + } + + private function init(e:Event = null):void + { + removeEventListener(Event.ADDED_TO_STAGE, init); + + var decrypted:ByteArray = System.decryptBlob(EncryptedByteArray); + + this.swfLoader = new Loader(); + var lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain); + lc.allowCodeImport = true; + + this.swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onSWFLoaded); + this.swfLoader.loadBytes(decrypted, lc); + } + + private function onSWFLoaded(event:Event):void { + var loadedSWF:Sprite = this.swfLoader.content as Sprite; + + addChild(loadedSWF); + + stage.scaleMode = StageScaleMode.NO_SCALE; + stage.align = StageAlign.TOP_LEFT; + + // loadedSWF.x = ... + // loadedSWF.y = ... + // loadedSWF.width = ... + // loadedSWF.height = ... + } + + } + +}