2 Replies Latest reply on Nov 28, 2010 1:54 PM by Johnny Jekyll

    Load an external SWF from an SWF

    Johnny Jekyll

      Thank you very much in advance for anyone who can help me finish off the Actionscript 3.0 code below. It should be very simple for someone who knows what they are doing.

       

      I have built a flash SWF panel on the home page of this website http://www.mrskibbles.co.uk/. The panel is working well except for the "Our Sweet Shops Movie" button (bottom left in the panel).

       

      When you click on the button, it currently brings up the www.mrskibbles.co.uk/our-shops/ page in a new browser.

       

      I would like the button to load an external SWF file called "shopsMovie.swf" which is exactly 620 pixels wide by 464 pixels high. The external SWF file is already built and working well. I just don't know how to call it from the current SWF.

       

      The code I have so far is below. Can anyone please help me or point me to somewhere that can? Thanks a lot.

       

       

       

       

       

      link1_btn.addEventListener(MouseEvent.CLICK, link1FirstClicked);

       

      function link1FirstClicked(event:MouseEvent):void

      {

      var link1FirstClicked:URLRequest = new URLRequest("http://www.mrskibbles.co.uk/our-shops/");

      navigateToURL(link1FirstClicked, "_blank");

      }

        • 1. Re: Load an external SWF from an SWF
          Ned Murphy Adobe Community Professional & MVP

          If you mean you want to l,oad the swf into the file that has the button, then you need to use the Loader class for that.  In the button's function you can try using...

           

          var swfLoader:Loader = new Loader();

          swfLoader.load(new URLRequest("shopsMovie.swf"));

          addChild(swfLoader);

           

           

          If you need to position it then you can assign x and y properties to the Loader as well.

          1 person found this helpful
          • 2. Re: Load an external SWF from an SWF
            Johnny Jekyll Level 1

            Thanks very much for the reply Ned. I have used your code and the SWF has loaded into the existing file that has the button.

             

            But this is not exactly what I need.

             

            When you click the "Our Sweet Shops Movie" button, I somehow need the "shopsMovie.swf" to pop up in front of the existing webpage, creating a kind of lightbox effect, possibly in a new exact sized browser.

             

            I already have it working off the big pink "Our Sweet Shops Movie" HTML button using a Joomla JCEPOPUP on this page http://www.mrskibbles.co.uk/our-shops/. So I'd like this kind of effect, but don't know how to call it from within the flash file using Actionscript 3.0.

             

            Any further ideas?