Skip to main content
Participant
June 16, 2014
Answered

Loader.loadBytes for swf with code (ABC) in iOS

  • June 16, 2014
  • 1 reply
  • 811 views


I'm at a loss.

I read blog and read help and I understand it's possible: loadBytes() must work.

But when I try do it I catch error (uncompiled ActionScript warning).

And then I found Release Notes with prohibited of loadBytes(): Methods unload() and loadBytes()of the loader class will not work on iOS

Where is true? Why some developres talk it's possible? How?

Thanx!

This topic has been closed for replies.
Correct answer Jeff__Ward

AFAIK, that Adobe blog is the correct and latest information with regards to iOS and assets with code in them.

So the only SWFs which you can load at runtime are those which you've packaged with ADT during packaging time.  This is because their ABC are compiled for iOS at that time, and their code is stored in the IPA.

So you'd load those SWFs with an app-local URL, like app://assets/level1.swf

You could load their bytes with the File class (./assets/level1.swf), and then I assume loadBytes would work.

It seems I've read that you can unzip the IPA and store those SWFs on a remote server, then load them at runtime and it works.  But the key is that you have to load the SWFs which were packaged with the app, as they've been cross-compiled for iOS and had their ABC stripped out and linked into your app.

All this is to be compliant with Apple -- all code must have been linked at packaging time.

1 reply

Jeff__Ward
Jeff__WardCorrect answer
Inspiring
June 16, 2014

AFAIK, that Adobe blog is the correct and latest information with regards to iOS and assets with code in them.

So the only SWFs which you can load at runtime are those which you've packaged with ADT during packaging time.  This is because their ABC are compiled for iOS at that time, and their code is stored in the IPA.

So you'd load those SWFs with an app-local URL, like app://assets/level1.swf

You could load their bytes with the File class (./assets/level1.swf), and then I assume loadBytes would work.

It seems I've read that you can unzip the IPA and store those SWFs on a remote server, then load them at runtime and it works.  But the key is that you have to load the SWFs which were packaged with the app, as they've been cross-compiled for iOS and had their ABC stripped out and linked into your app.

All this is to be compliant with Apple -- all code must have been linked at packaging time.

NoviyDiskAuthor
Participant
June 18, 2014

I checked it out. Really works.

It does not work with dynamic swf files. Ie files that assemble from ByteArray AFTER AOT compilation (at runtime).

If the file is passed through the AOT compilation, then it can be loaded by loadBytes. Probably it can be change some bytes except bytes block of ABC (block of code).