简体   繁体   中英

How do I access assets inside a APK file using ActionScript 3? (Adobe AIR)

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

After export I've got the APK file. If I open it in WinRAR there is a folder "assets" there. Inside are main.swf (my program) and the folder "images" (that contains JPG imags).

My question is, how can I access these packaged JPG images via ActionScript 3 in my program?

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

I can't embed the JPG images inside the swf file directly because they are too many. And the images must be packaged inside the actual APK file.

Figured it out myself, or rather realized it with some help, in my other question:

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

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

Just have to use the COMPLETE event and keep in mind that the VM is single-threded so I can't "sleep a thread" while the image loads.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM