10 Replies Latest reply on Jun 25, 2009 11:42 AM by Frazko

    Loading and modifying a SWF file within an AIR application

    Ggnosfex

      I bet you get this question a lot, but I was wondering, if possible, anyone knows how to edit and save the changes to a SWF file loaded inside an AIR application?

      Thanks in advance!

        • 1. Re: Loading and modifying a SWF file within an AIR application
          Michael Borbor Level 4

          I don't think you can modify a SWF, you could however save 

          configuration changes in external XML files using the Spring Framework 

          for instance.

           

          Sincerely,

           

          Michael

           

          El 17/06/2009, a las 13:07, Ggnosfex <forums@adobe.com> escribió:

           

          >

          I bet you get this question a lot, but I was wondering, if possible, 

          anyone knows how to edit and save the changes to a SWF file loaded 

          inside an AIR application?

          Thanks in advance!

          >

          1 person found this helpful
          • 2. Re: Loading and modifying a SWF file within an AIR application
            Ggnosfex Level 1

            Thanks for the quick answer! However, I believe that you could do such a thing ( or maybe the adobe team should think about it  ). I just had a quick read on the SWF specification, and there is some explanation on how to perform that, so if nobody comes up with an exact answer, I'll research that.

            • 3. Re: Loading and modifying a SWF file within an AIR application
              Michael Borbor Level 4

              Could I ask when you say modify what do you mean? What are you 

              planning to do?

               

              When you create an app you can modify the whole app appeareance using 

              CSS for instance. So I'm curious to know what your ideas are.

               

              Sincerely,

               

              Michael

               

              El 17/06/2009, a las 13:43, Ggnosfex <forums@adobe.com> escribió:

               

              >

              Thanks for the quick answer! However, I believe that you could do 

              such a thing ( or maybe the adobe team should think about it   ). I 

              just had a quick read on the SWF specification, and there is some 

              explanation on how to perform that, so if nobody comes up with an 

              exact answer, I'll research that.

              >

              • 4. Re: Loading and modifying a SWF file within an AIR application
                Ggnosfex Level 1

                It's basically a level editor for a game. I have a flash application that loads an external swf. I use the resources from this loaded swf inside the main app. I'm building an editor in AIR, so I can modify, for example the position of the objects inside the swf. I know I can do it with xml, and even inside flash I can modify the objects and then compile the swf, but it's not as flexible for other team members who are not proficient with flash.

                • 5. Re: Loading and modifying a SWF file within an AIR application
                  Rich_Sas

                  Here's a thought: I doubt you can edit a SWF that is in use, but given that the SWF file format is (supposedly) well documented you could load the SWF file as a regular binary file into a ByteArray and make your changes to the ByteArray (or some object that you instantiate from the raw data in the ByteArray), then save it back out.

                  1 person found this helpful
                  • 6. Re: Loading and modifying a SWF file within an AIR application
                    Ggnosfex Level 1

                    After reading the documentation, that was my plan, anyways, you get a star for getting more or less the same idea Thanks!

                    • 7. Re: Loading and modifying a SWF file within an AIR application
                      Michael Borbor Level 4

                      I personally think that you're trying to reinvent the wheel in there, you

                      could have a program that generates the changes, then submit those changes

                      to a server and in there, you send instructions to compile this new file

                      using the Flex compiler or the AIR compiler. Finally send back this new SWF.

                      • 8. Re: Loading and modifying a SWF file within an AIR application
                        Rich_Sas Level 1

                        That's not a bad approach Michael and would certainly be pretty easy to piece together with PHP or something like that, but before chosing one solution over another I'd be interested in more info on the use case. One of the beautiful things about AIR and RIA's in general is that you can distribute the processing load off of your own servers and back to the abundant processing power of modern computers. So depending on where your bottleneck is, or what your sensitivity towards your Cost Of Goods, or the response time needed for a given app, you may not find a server-side solution ideal. It always comes down to a clear understanding of the use case and the constraints (which almost always come back to COGs).

                        • 9. Re: Loading and modifying a SWF file within an AIR application
                          Ggnosfex Level 1

                          I'm sorry, but I happen to digress greatly with Michael's approach. I started using AIR  just yesterday ( 3 hours or so ), and I firmly believe in reinventing the wheel as a strong method of learning. Just to be clear, I do this on my own free time, so I have no need to worry about COGs, after all, I'm just learning. Otherwise, though it's a strong and great response if I were to build a somewhat bigger application, it's way too much more than the original scope of the application. It's like using a bazooka to kill ants . Regarding the scope of the application, it should support loading / writing of SWFs, and editing of XMLs for certain pre-defined entities. As I stated already, I am certain that I'd be able to do this in a very short span of time with another approach (more xmls, embedding assets directly to the SWF that loads the edited swf, etc.) It's more of a challenge to myself than anything else . I'm really grateful for all your help, so if you want, I can keep you up to date on how I deal with the issue.

                          • 10. Re: Loading and modifying a SWF file within an AIR application
                            Frazko

                            I like a lot this idea.. and I also want to know how to write/export swf files from flash player 10 or AIR..  where can I get more info on this???  I'm thinking about an app to make greeting cards.. that you can add your animations and images etc.. and then save the swf file... what do you think ?