2 Replies Latest reply on Aug 22, 2013 6:42 PM by Ned Murphy

    Link between swf files.

    EdWeKmon

      Hello. I need to find a way to link multiple .swf files, so I may have a menu and after clicking a button go from there  to any swf file and back. But i need something that works in AS 2 and 3 because my files are in both ActionScripts. It shouldn't be a problem, right? Ive been looking for and trying different things but i can't do it.

       

      Hope someone can help

       

      Thanks.

        • 1. Re: Link between swf files.
          EdWeKmon Level 1

          Also I have this code that works in AS3 but only for one button, when I try to make another one flash marks error. I cant link another button with another file.

           

           


          var loadedSWF:Loader = null;

          /**
          * Loads an SWF and adds it to container once complete
          * @param file The URL to the SWF to load
          * @param container The container to add the SWF to
          */

          function loadSWF(file:String, container:MovieClip=null):void
          {
             
          if(container == null) container = MovieClip(root);

             
          // removes the previously loaded SWF
             
          if(loadedSWF != null)
             
          {
                 
          if(loadedSWF.parent) loadedSWF.parent.removeChild(loadedSWF);
             
          }

             
          var req:URLRequest = new URLRequest(file);
              loadedSWF
          = new Loader();
              loadedSWF
          .load(req);

              addChild
          (loadedSWF);
          }

          mybutton.addEventListener(MouseEvent.CLICK, _click);
          function _click(e:MouseEvent):void
          {
              loadSWF
          ("myfile1.swf");
          }
          • 2. Re: Link between swf files.
            Ned Murphy Adobe Community Professional & MVP

            If that code works then it is probably on the right track to getting it to work for multiple files.  Show the code you tried that produced an error and show the error as well.