4 Replies Latest reply on Feb 21, 2007 1:20 AM by stormmedia

    getURL not working when swf is loaded into another swf

    stormmedia
      Ok, I need some help for something relatively simple which for some reason I've not been able to find any information on at all?

      Hopefully it will be something easy to fix.

      Essentially I have the following:

      • my main movie "Home.swf"
      • another movie "Sub.swf"

        I've loaded "Sub.swf" into "Home.swf" via an empty movieclip.

        Within "Sub.swf" I have some links which when clicked call getURL and open a HTML page in the browser.

        But for some reason the getURL isn't working and I believe its because the getURL is called from a loaded movie within "Home.swf".

        I've tried changing the actionscript to:

        _root.getURL('/mypage.html');
        _parent.getURL('/mypage.html');

        but neither (_root / _parent) seems to work?

        Need help here please.

        Many thanks.

        Kind regards,
        M.
        • 1. Re: getURL not working when swf is loaded into another swf
          kglad Adobe Community Professional & MVP
          are you sure your getURL() is executing? use a trace() function inside your button handler to make sure your button is receiving your mouse event.
          • 2. Re: getURL not working when swf is loaded into another swf
            stormmedia Level 1
            Hi kglad,

            Yes the button is definitely firing ok.

            In the "Sub.swf" movie, on the second frame of the timeline (the first frame is some preloader code) there is the following code:

            /****************************************************************************/
            imgMC.mascara.onPress = function() {
            //trace('mc[activo] = ' + mc[activo]);

            switch(mc[activo])
            {
            case _level0.imgMC.MC0:
            trace('0 - ' + mc[activo])
            break;

            case _level0.imgMC.MC1:
            trace('1 - ' + mc[activo])
            break;

            case _level0.imgMC.MC2:
            trace('2 - ' + mc[activo])
            break;

            case _level0.imgMC.MC3:
            trace('3 - ' + mc[activo])
            break;

            case _level0.imgMC.MC4:
            trace('4 - ' + mc[activo])
            break;

            case _level0.imgMC.MC5:
            trace('5 - ' + mc[activo])
            break;
            }
            };
            /****************************************************************************/

            If I run this movie in Flash (ctrl-enter) then the trace works fine.

            But the trace stops working when I run the main "Home.swf" movie in Flash (ctrl-enter) when the "Sub.swf" is loaded into an empty movie clip.

            And when I change the trace for a getURL and test in a browser it still doesn't work?

            What do you reckon?

            Thanks.

            M.
            • 3. Re: getURL not working when swf is loaded into another swf
              kglad Adobe Community Professional & MVP
              it's not the getURL that's the problem. it's your _level0.imgMC.MC5 that's the problem.

              in Sub.fla, replace _level0 by _root and add to the code above your onPress code:

              • 4. Re: getURL not working when swf is loaded into another swf
                stormmedia Level 1
                Thank you kglad!

                This got the problem sorted.

                M.