2 Replies Latest reply on May 13, 2006 6:13 AM by Newsgroup_User

    unloadMovie Works Only Once

    SoCalMX
      Any help is VERY much appreciated:

      The following code is used to display a help message and then remove it.

      A single button is used to toggle the display of the help message. The code works fine the first time:

      - Click "btn_photoHelp" and you get the help message, click again and it's gone.
      - Click a 3rd time and you get the help message, click again and the message does not unload (and never will again).

      Can anyone help with this one? As a note, the problem is not related to the "helpAlreadyClicked variable", as that has been tested extensively and is working fine. Also, note sure what this means, but "trace(my_newHelpSWF.getDepth())" always shows a depth of 1048576.

      I am using unLoadMovie and not removeMovieClip, as the following is included in the Flash Help documentation:
      If you must use getNextHighestDepth() with version 2 components, you can use swapDepths() to assign a valid depth value or use MovieClip.unloadMovie() to remove the contents of the movie clip.

      here's the code

        • 1. Re: unloadMovie Works Only Once
          samdl1 Level 1
          use a number instead of getNextHighestDepth() for your attachMovie method and see if it works...if it does chances are you have components in your movie which can make getNextHighestDepth() act erratically, instead, use the depth manager (see flash help) to assign depths and go from there

          Sam
          • 2. Re: unloadMovie Works Only Once
            Level 7
            I think you want removeMovieClip, not unloadMovie.

            Try this code instead of what you have now:

            var helper:MovieClip;
            //
            btn_photoHelp.onRelease = function() {
            if (!helper) {
            helper = this._parent.attachMovie("newHelpSWF", "my_newHelpSWF",
            this._parent.getNextHighestDepth(), {_x:95.4, _y:389});
            } else {
            removeMovieClip(helper);
            helper = undefined;
            }
            };

            --
            Dave -
            Adobe Community Expert
            www.blurredistinction.com
            www.macromedia.com/support/forums/team_macromedia/