Re: [flexcoders] Writing images to the src folder in flex/air

2010-02-18 Thread Johannes Nel
first off, you don't want to save them in your src folder since this is only
available at compile time and not in the deployed application. Also, if you
are deploying to a Mac, you can't save things in your application directory,
this will give you a security error, you should rather save to the documents
directory or the application storage directory.

Since you are working with an air application, there really is no need to
embed them in the application, these resources will be available immediately
from the local file system, (also embeding them will mean they are part of
your swf and thus unchangeable).

So take a step back and think about it again.
What I propose is the following, check if the image exists in your storage
directory (if that is where you save it) if not, load the image from the
application directory, which is the image which you packaged into the
installer.

On Thu, Feb 18, 2010 at 3:24 PM, James wrote:

>
>
> In my app I have a jpegencoder which saves bitmap snapshots of components
> as jpgs in my images folder (assets/images). The problem is it saves them in
> the bin-debug folder rather than the src folder.
>
> The reason I want them in the src folder is so that I can embed them within
> the app and it seems you can't embed images that are in the bin-debug
> folder. The reason I want to be able to save them directly into the
> src/assets/images folder is so that they will replace current images I have
> stored there which are embedded within the app so hopefully as they are
> saved these will replace the images live within the app if that makes sense.
>
> The current line of code I have which saves the images in the bin-debug
> folder is this:-
>
> var file:File =
> File.applicationDirectory.resolvePath("assets/images/testpicture.jpg");
>
> Can anyone tell me how to modify this so that they save in the source/src
> folder rather than the bin-debug folder? Thanks.
>
>  
>



-- 
j:pn
\\no comment


[flexcoders] Writing images to the src folder in flex/air

2010-02-18 Thread James
In my app I have a jpegencoder which saves bitmap snapshots of components as 
jpgs in my images folder (assets/images). The problem is it saves them in the 
bin-debug folder rather than the src folder. 

The reason I want them in the src folder is so that I can embed them within the 
app and it seems you can't embed images that are in the bin-debug folder. The 
reason I want to be able to save them directly into the src/assets/images 
folder is so that they will replace current images I have stored there which 
are embedded within the app so hopefully as they are saved these will replace 
the images live within the app if that makes sense.

The current line of code I have which saves the images in the bin-debug folder 
is this:-

var file:File = 
File.applicationDirectory.resolvePath("assets/images/testpicture.jpg");

Can anyone tell me how to modify this so that they save in the source/src 
folder rather than the bin-debug folder? Thanks.