I'm using air for this and so far I can make bitmaps and convert them into jpegs from within my app and place them on the desktop using the following code:-
var file:File = File.desktopDirectory.resolvePath("abcnews_small.jpg");
This creates the abcnews_small.jpg file on the desktop and overwrites it if it already exists there. However what I want is for my app to overwrite jpgs that I've already embedded IN the app but I'm struggling to figure out how to do this. My jpgs are all stored in the src folder under assets/images/ so for example my project is called liveimage and the location in which my abcnews_small jpg is located is liveimage/src/assets/images/abcnews_small.jpg
and it's embeddded in the app like this:-
public var abcnewspicture:Class;
So if I can set up the following line of code so that it saves the new jpg in the above location that'd be perfect. I've tried the following but it doesn't work:-
var file:File = File.applicationStorageDirectory.resolvePath("abcnews_small.jpg");
If anyone can help me out on this I'd be grateful. Thanks.
When you use the Embed metadata, the image is no longer stored in a separate file -- its bytes are part of the application SWF. You can't change those bytes at runtime. You will need to store and load the images externally in order to update them. Note that you should not (and sometimes cannot) write to the application directory. You should save and load the update images to the application storage directory.
Thanks Joe. Now I just need to figure out a way of getting my images into the icon fields into the items in my array collection without embedding them.
Cheers for the help.