2 Replies Latest reply on Feb 19, 2010 9:35 PM by jimmyoneshot

    Getting A File To Save In a Location So It Overwrites Currently Embedded Jpegs

    jimmyoneshot Level 1

      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:-

       

      [Bindable]
      [Embed(source="assets/images/abcnews_small.png")]
      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.