6 Replies Latest reply on Jul 13, 2011 7:17 AM by xandos159

    SWF within SWF


      Hi guys, first off, sorry for the newbie question!


      I'm hoping to stitch together a few flash panoramas, which many programs automatically generate - and allow you to mark hotspots in the panorama that lead to a web link when clicking. I can use this functionality to get basically everything I want, however, I need them to exist within an SWF object embedded on a page... At the moment, it works as it is but only if you're loading the SWF files directly to the browser... For example, load room1.swf, upon clicking on the door a hyperlink is opened and the browser then loads corridor.swf etc. Whereas I need this to all be happening within one SWF embedded on a page.


      I would very much appreciate if someone could point me in the right direction for this one..


      Many thanks for your time...

        • 1. Re: SWF within SWF
          Ned Murphy Adobe Community Professional & MVP

          Either make them as movieclips within a single swf file, or load the individual swf's into the main file dynamically.

          1 person found this helpful
          • 2. Re: SWF within SWF
            xandos159 Level 1

            Thanks Ned,


            That's sort of what I'm thinking - but do you have any idea how this will work if the only interactivity I have with those SWFs is that they go to a web address when a hotspot is clicked - in terms of linking them together within the SWF instead of to URLs on a server?

            • 3. Re: SWF within SWF
              robdillon Most Valuable Participant

              From your description, it sounds like you are replacing one .swf with another when the user clicks on one of these hotspot links. You can import any number of .swfs into the .swf that is loaded into the web page. This is the most common method of building a complex flash movie: use many small .swf files then load and unload each file as needed. In AS3 you use a URLRequest() method to import an additional .swf into your first .swf movie. Once downloaded, you can then position and play this new .swf as a child of the first movie. You can remove this child movie when your user has finished with it. You can repeat this process with as many movies as you like.


              You can load in these additional movies right after your first movie loads, or you can wait until the user clicks on the link.

              1 person found this helpful
              • 4. Re: SWF within SWF
                xandos159 Level 1

                Many thanks for the reply Rob.


                Yes, that is exactly what I'm doing - there is just one complication! I am not creating the panorama SWFs myself, they are automagically generated - and the only command they can run when a hotspot is clicked is to send to a URL... So I need to intercept this command somehow within the SWF (and use it to load another swf), instead of at a webpage level... Does that sound possible?


                Everything else mentioned sounds on the money....

                • 5. Re: SWF within SWF
                  Ned Murphy Adobe Community Professional & MVP

                  If the swf's are using navigateToURL/getURL commands, then I don't think there is anything you can do to circumvent that happening short of disabling the ability to click the hot spots.


                  So maybe what you need to do is to disable all interaction with the loaded files and overlay your own interactions on top of them.


                  Here's one idea to consider... when you import an swf into an fla, the swf will lose its actionscript.  So you could recreate the swf's that way with your own hotspots that dispatch events that you can process thru a parent swf.  But if the swf's have some panoramic controls in them those would be lost as well.


                  Rob might have some better ideas to offer.

                  • 6. Re: SWF within SWF
                    xandos159 Level 1

                    Thanks Ned, I was worried that might be the case.


                    Unfortunately the interactions need to remain, as you need to select objects that are placed around the panorama, which obviously go through the same perspective distortion as the panoramic image itself...



                    On a lateral note, is there a better way of doing this? I assume there is! One might think a component that works with panoramas or something?