5 Replies Latest reply on Mar 14, 2010 10:19 PM by Harry Kunz

    listing movie clips

    Jev.Shi

      After dragging many MovieClips/Components onto the stage, how can I generate a report (or display on screen) by listing the names, parameters, values of all the movie clips/components dragged on the stages?

       

      Highly appreciate any help/hints on coding or samples...

       

      Thanks
      Jev

        • 1. Re: listing movie clips
          kglad Adobe Community Professional & MVP

          you can use the following but be forewarned:  there's a lot of data presented:

           

           

          doF(MovieClip(root));

           

          function doF(dobj:DisplayObject){
              trace(describeType(dobj));

              trace("*****************");
              if(dobj is DisplayObjectContainer){
                  var dobjC:DisplayObjectContainer = DisplayObjectContainer(dobj);
                  for(var i:uint=0;i<dobjC.numChildren;i++){
                      doF(dobjC.getChildAt(i));
                  }
              }

          1 person found this helpful
          • 2. Re: listing movie clips
            Harry Kunz Level 4

            It is a good idea to state whether you are using AS2 or AS3 so that we will know what kind of code we will post. The above code might work for you in AS3. Just fix the syntax error by supplying a "}" at the end. If you are working on AS2, you can use this code:

             

             

            for(var mcStageMc in _root)

            {

               var mc:MovieClip = _root[mcStageMc];

               if(mc instanceof MovieClip)

               {

                  trace("Name: " + mc._name);

                  trace("_x: " + mc._x);

                  trace("_y: " + mc._y);

                  //Trace other properties you like

               }

            }

            1 person found this helpful
            • 3. Re: listing movie clips
              kglad Adobe Community Professional & MVP

              if he's using as2, that won't work.  use

               

               

              traceF(_level0);

               

              function traceF(mc:MovieClip){

              for(var s:String in mc){

              trace(s+": "+mc[s]);

              if(typeof(mc[s])=="movieclip"&&mc[s]._parent==mc){

              traceF(mc[s]);

              }

              }

              }

              • 4. Re: listing movie clips
                Jev.Shi Level 1

                Hello, Kglad / Harry,  thanks a lot.  I am using AS3.

                • 5. Re: listing movie clips
                  Harry Kunz Level 4

                  You're welcome.