1 Reply Latest reply on Feb 18, 2010 5:27 AM by jimmyoneshot

    Flex Not Recognising Jpegs I've Created via JPEG Encoder

    jimmyoneshot

      I have an application which takes snapshots of components and then converts the bitmap data of the snapshots into a jpeg via a jpegencoder and saves these jpegs in my images directory (assets/images). The strange thing is I can't embed these images the way I can embed others and it's almost like flex doesn't see them there in the folder when I try to embed them. For example using the app I made a jpeg called testpicture.jpg and it saved in the assets/images folder just like I wanted it to along with all the regular images I have but when I tried to embed it using the following code:-

       

      [
      Bindable][
      
      Embed(source="assets/images/testpicture.jpg")]
      
      public var testpicture:Class; 
      

       

       

      Flex shows the "unable to resolve..." and "unable to transcode...." errors for that bit of code as if the image is not there when I can actually see it there sitting alongside my regular images. I've tried embedding my regular jpeg images (made in paint) from the same folder this way and they work fine so it seems it's something to do with images created via the jpeg encoder.

       

      Has anyone else encountered this problem and can you help me figure out what it is? Thanks for any suggestions

        • 1. Re: Flex Not Recognising Jpegs I've Created via JPEG Encoder
          jimmyoneshot Level 1

          EDIT: I think I've recognised the problem. It was that my app was saving them into 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 unless I'm mistaken. 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 src folder rather than the bin-debug folder or is it possible to embed images that are in the bin-debug folder? Thanks.