4 Replies Latest reply on May 10, 2010 2:19 AM by kiran7881

    What is the Need for embed an Image in a Flex Application

    kiran7881 Level 1

      Hi everybody ,

       

      As every site says "

      Flex supports embedding JPEG, GIF, and PNG files"

       

      Can anybody please let me know what does embed an image mean ?? and why is it required ??

       

      Please share your views on this .

        • 1. Re: What is the Need for embed an Image in a Flex Application
          Matt Le Fevre Level 4

          As far as i see it, it's mainly just for convenience.

           

          Embedding an image into application removes the need for you to store it elsewhere on the server, as it becomes part of the .swf file.

           

          From personal experience it's very handy with small images, as it doesn't increase the size of the .swf file too much, and it means you don't have to keep track of them when distributing your release build.

           

          you don't have to embed anything, you can simply reference it by location instead, but you'll experience a slight delay as it's loaded into the application on request.

           

           

          The need for using this feature depends entirely on what you're trying to accomplish.

           

          If you're making something like a large image gallery, it'll completely remove the need for wait for pictures to load when  you're scrolling through them. However i wouldn't recommend it as you'll send your application size will go through the roof, and the waiting time for the whole application to load would be fairly extensive.

           

          If you have an application with like 40 small ~3kb images using for navigation icons or something, you might as well, it's just convenient and won't impact the loading time by too much.

          • 2. Re: What is the Need for embed an Image in a Flex Application
            David_F57 Level 5

            hi,

             

            There are many reasons where it is preferable to use embedded assets, not just images but also things like xml files, static assets are usually best embedded in the application where as assets that are interchangable or extremely large maybe better suited to a dynamic approach.

             

            If you have say an application that will have a set menu(which is held in an xml file) and graphic background the application will present much better if after the load progressbar completes the application appears 'instantly' rather than assembling itself as the user watches,  embedding the menu xml and the background acheives a more fluid application launch.

             

            Another good use of embedded assets is for things like menu and button icons. If you have 40 buttons in your app with a tick and another 40 with a cross its better to embed 1 image for the cross and 1 for the tick  rather than each button calling the icon dynamically, this would result in 80 calls being made to the server (say 80k) instead of 2k added to the size of the swf.

             

            Embedding is really a design decision and is the better choice if it optimises the loading and running of the application.

             

            David.

            • 3. Re: What is the Need for embed an Image in a Flex Application
              Flex harUI Adobe Employee

              Small images that won't change are sometimes better to embed so they are in

              the SWF and do not require a separate asynchronous network request.

              1 person found this helpful
              • 4. Re: What is the Need for embed an Image in a Flex Application
                kiran7881 Level 1

                I thank you all for taking time to answer questions .

                 

                As per my understanding the  conclusion is that

                 

                "Embedding an image into application removes the need for you to store it elsewhere on the server, as it becomes part of the .swf file."

                 

                Now my query is that

                 

                In all the examples of embed images i see simialar as :

                Will this is required for the first  time ??

                <mx:Image source="@Embed('./image.gif')"/>

                 

                 

                Can you please let me know why the loaction of the image is still referred ?>