sivri
sivri

Reputation: 25

How can I add jpg files to ipa and load them with FileStream class

I'm developing a tile engine with actionScript-3 for IOS machines. Is there a way to package JPG files with IPA and then read them with Adobe Air's FileStream Class. I need to read files asynchronously. Embeding them or putting them in a swc wouldn't help.

I understand how it works on desktop.

var file:File = File.documentsDirectory.resolvePath("myfile.txt");

On desktop, means:
[user_dir]/Documents/myfile.txt

On IOS:
[app_dir]/Documents/myfile.txt

How can I package the IPA that has "myAsset.jpg" in "[app_dir]/Documents/" directory?

I tried to open a "Documents" directory and put some files in it and include it in the package content section of the run configration of flash builder 4.5.1. But that didn't work.

Thank you.

Upvotes: 0

Views: 1373

Answers (2)

Nacron
Nacron

Reputation: 11

One Addition to Joes answer:

When you add a folder over adt the actual folder is added not its contents. So if you add the Folder assets you access your images like this:

File.applicationDirectory.resolvePath("assets/image.jpg");

Upvotes: 1

Joe Ward
Joe Ward

Reputation: 759

When you package the image files with your application, they will be in the application directory, which you can access with the File.applicationDirectory property. You should be able to load your images directly from there. If you want the images in the documents directory, you will have to copy them there after installation.

Upvotes: 1

Related Questions