0 Replies Latest reply on Aug 13, 2009 1:09 AM by etokcan

    Image Embedding in Flex


      Hello to all,


      Here is the deal. I use flex&as3 in flex builder rather than flash. Assume we have a png picture that is 4.5 mb in size. when i import it to library in flash cs4, and then hit ctrl+enter (compile it), the swf file I obtain is 660 kb and i can reach the image inside using swfloader in my actionscript code. This is awesome because file size gets reduced tremendously without any loss in the quality. Therefore i thought it would be nice to automate the conversion to swf. I have written the following class:


      package {
          import flash.display.Sprite;
          import flash.display.Bitmap;
          import flash.display.MovieClip;


          public class Im2Swf extends MovieClip
              public var im2swf:Class;
              public var img:Bitmap=new im2swf();
              public function Im2Swf()


      I have also written a java program that manipulates the embed line of the actionscript code above to reach pictures with different locations and names. finally i have written a batch file that executes the java code and after it's done, compiles the altered actionscript code to produce a swf file with my desired image in it. However the resulting swf file is bigger than the image itself when i do this whole thing using that method. so here is my question: what is flash doing to reduce the size of the images and how can i do it in my code in order to achieve the same thing? aforementioned files are attached if you would like to take a closer look. thank you all.