1 Reply Latest reply on Jul 28, 2006 9:41 PM by karma-lab

    Problem with RemoveMovieClip - code works in AS 1.0, not 2.0

    karma-lab Level 1
      I have a fully functional Flash patch created with MX2004, Action Script 1.0. I'm now reworking it with Flash 8, and compiling it for ActionScript 2.0.

      I have a clip that is created like this:

      _root.attachMovie("DynamicLoadScreen", "loadscreen_mc", _root.getNextHighestDepth());

      This creates a dynamic loadbar that appears on top of a loading clip.

      When the clip is done loading, I dispose of the loadbar:


      This has always worked perfectly fine with AS 1.0 (still does, if I change the publish setting). Now, with 2.0, it fails. The clip doesn't go away, nothing happens, it just stays there.

      I did notice the following in the help file reference about MovieClip:

      The MovieClip.getNextHighestDepth() method used in this example requires Flash Player 7 or later. If your SWF file includes a version 2 component, use the version 2 components DepthManager class instead of the MovieClip.getNextHighestDepth() method.

      Now, it's true that I have added a combobox component to this file that it never had before. Maybe that's my problem?

      If I set the publish settings to AS 1.0, and test it, the removeMovieClip() code works, but my combo box is not available. If I compile for AS 2.0, the RemoveMoveClip() code about doe NOT work, but my combo box is there.

      Now looking for info on the DepthManager. What a PITA! Any pointers appreciated...

        • 1. Re: Problem with RemoveMovieClip - code works in AS 1.0, not 2.0
          karma-lab Level 1
          I'll answer my own question:

          Yes, you need to use the DepthManager, if you are using v2 components. It's pretty simple, although not very clear from the documentation how to move from one to the other. If you used to do something like:

          someClip.attachMovie("DynamicLoadScreen", "loadscreen_mc", someClip.getNextHighestDepth());

          Now do:

          import mx.managers.DepthManager; // at the beginning of your AS
          someClip.loadscreen_mc = someClip.createChildAtDepth("DynamicLoadScreen", DepthManager.kTop);

          Disposing it works the same as previously.