Work around flash security errors
authorTom Hughes <tom@compton.nu>
Tue, 13 Nov 2012 15:19:22 +0000 (15:19 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 13 Nov 2012 15:19:22 +0000 (15:19 +0000)
Flash 11.2.202.251 on linux throws security errors trying to
retrieve data from a loader that has been put there with loadBytes
so we stash a copy in our extended info so we can get it back later.

net/systemeD/halcyon/FileBank.as

index c79e2ba..6e2a315 100755 (executable)
@@ -104,7 +104,9 @@ package net.systemeD.halcyon {
         }
 
         private function loadedImage(event:Event):void {
-                       fileLoadComplete(event.target.loader.info);
+                       var loader:ExtendedLoader = event.target.loader;
+                       loader.info.bytes = loader.contentLoaderInfo.bytes;
+                       fileLoadComplete(loader.info);
         }
         private function loadedFile(event:Event):void {
                        fileLoadComplete(event.target.info);
@@ -156,6 +158,7 @@ package net.systemeD.halcyon {
                                        var loader:ExtendedLoader=new ExtendedLoader();
                                        files[prefix+fileref.name]=loader;
                     loader.info.filename = prefix+fileref.name;
+                                       loader.info.bytes = data;
                                        loader.loadBytes(data);
                                } else {
                                        // Store as a document
@@ -236,7 +239,7 @@ package net.systemeD.halcyon {
                }
                
                public function getAsByteArray(name:String):ByteArray {
-                       return files[name].contentLoaderInfo.bytes;
+                       return files[name].info.bytes;
                }
                
                public function getAsString(name:String):String {