6 Replies Latest reply on Aug 2, 2011 1:26 AM by Roopesh_Verma

    How to embed an image in swf at run time?

    Roopesh_Verma

      Hi all,

       

      I have created an Image component in flash which is having a "imageSource" paramter, where in a user can provide the path of his/her image(both from web or from  harddisk). I want that image to be compiled with the swf. how can i do that?......any help will be greatly appreciated

       

      Thanks,

      Roopesh

        • 1. Re: How to embed an image in swf at run time?
          kglad Adobe Community Professional & MVP

          if you want the image to be compiled with the swf your component is irrelevant.  you could make a jsfl file that adds an image to a fla so it can be compiled with the swf but the instructions for using that jsfl are going to be more complicated than instructions for adding an image to the fla without your jsfl.

          1 person found this helpful
          • 2. Re: How to embed an image in swf at run time?
            Roopesh_Verma Level 1

            Hi kglad,

             

            Thanks for the reply.

             

            Basically what i want is a component where a user can drag the component to the stage and select some image from his/ her local disk and configure the component to show that image and publish it. And the generated swf should be directly deployed to the server. Is there any way to do it ?

            http://forums.adobe.com/people/kglad

            • 3. Re: How to embed an image in swf at run time?
              kglad Adobe Community Professional & MVP

              there is a way to do that but i don't know how.  at least one of the current components (flvplayback) has an open file dialogue capability that does what you want.  you could decompile that component and see how that's done.

              • 4. Re: How to embed an image in swf at run time?
                Roopesh_Verma Level 1

                Hi kglad,

                 

                Thanks alot for your quick reply.

                 

                well I have created such a custome component, which user can drag on stage and configure accordingly. If a user provides the path of a image which is on server, things works fine as when i deploy my swf to server it fetches the image properly but if a user provides the path of a image which is present locally on hardisk, image is not loaded when the swf is deployed to server as the path provided is local . So i am searching for a solution for resolving this path conflict issue in desgin and deployment phase. one probable solution is, if the images gets embedded with swf but embedding is not possible at run time. Do you have any other solution for this?

                • 5. Re: How to embed an image in swf at run time?
                  kglad Adobe Community Professional & MVP

                  the adobe components have the same problem so i don't think there's an easy solution.

                   

                  you could detect whether a drive letter is in the path (and determine that an absolute path is being used), display a warning to the user that they should be using a local path.

                   

                  p.s.  what do you use to trigger an open-file dialogue?

                  • 6. Re: How to embed an image in swf at run time?
                    Roopesh_Verma Level 1

                    I haven't used open file dialouge, I have just used a text input where a user has to write the path of the file. I am researching on that, once i get any solution will post it here.