How to access assets in an APK file using ActionScript 3? (Adobe AIR)

I made a program using Flash Pro CS6. Now, using Adobe AIR, I export it to "AIR for Android." In the settings under the "included files", I added the "images" folder, which will be packed inside the resulting APK file. This folder contains jpg images.

After exporting, I have an APK file. If I open it in WinRAR, there will be an "assets" folder. Inside are main.swf (my program) and the "images" folder (which contains JPG imags).

My question is: how can I access these packaged jpg images through ActionScript 3 in my program?

For example, the image "/assets/images/0001.jpg", I want to be able to display it at runtime in swf (which is also packaged inside an APK file and runs through AIR on Android).

I cannot embed JPG images inside a swf file directly, because there are too many of them. And the images must be packaged inside the actual APK file.

+4
source share
1 answer

I thought for myself, or rather, realized this with some help in my other question:

Reading JPG in BitmapData in ActionScript 3 (JPG is inside the APK file)

loader.load(new URLRequest("app:/images/image.jpg")); 

You just need to use the COMPLETE event and remember that the VM is one-time, so I cannot "sleep in the stream" while the image is loading.

+6
source

Source: https://habr.com/ru/post/1440983/


All Articles