Search code examples
apache-flexactionscriptarraysloader

Actionscript Loader.loadBytes() silently bails out, Complete Event never fired


i am using the following setup:

  1. i load a local file with FileReference.load() into the swf
  2. then i user Loader.loadBytes() to parse the loaded ByteArray into BitmapData to pass it to a BitmapImage's source

step 1 works fine and i get the bytearray which is about 36k, according to the progressevent.

now i pass the the data as follows: loader.loadBytes(event.payload as ByteArray);

here's where i'm stuck. i have listened both for Event and DataEvent but nothing happens. i enclosed the part in a try/catch statement, still nothing. i ran it with the debugger and: NOTHING. it just seems to do nothing after calling loadBytes.

i looked up a lot of threads about complete events not firing on loader, but nothing similar to my problem.


Solution

  • ok, i gave up on this. it was probably my fault somewhere but i ended up just adding the loader itself and stopped trying to load the bytearray into a bitmapimage.