A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Can I list instance names of my movies?

  1. #1
    Senior Member martin47's Avatar
    Join Date
    Dec 2000
    Posts
    413

    Can I list instance names of my movies?

    Weird question, for sure. I have a movie that randomly generates duplicated movies with random names. Is there a way to check or list all the movie instances on the root of a movie?
    http://www.drakon.com.ar

  2. #2
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813
    Yes, you can. I assume that you are populating the name of each MC when you duplicate it. You can loop through the DisplayObject using the numChildren and the length and pull the names you want.

    I suggest that when you duplicate a movie you store it in an array, this way it is much easier to access and identify, don't rely on the naming convention of Flash alone.
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

  3. #3
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    only if this is AS3.. (which in that case would probably be better served, by being posted int he AS3 forum?)

    I dont believe AS2 has a Display Object..

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Or, if this is for debugging only, once in test mode, you can also select debug>list objects. You'll see them all with their absolute paths.

    gparis

  5. #5
    Senior Member martin47's Avatar
    Join Date
    Dec 2000
    Posts
    413
    Thank you all, you clarify mi mind. I am using AS2, I think the array will be the best way, but I just wanted to check if there was another option. Thanks!
    http://www.drakon.com.ar

  6. #6
    :
    Join Date
    Dec 2002
    Posts
    3,518
    AS2 code...
    Code:
    function doShowMC(mc) {
    	for (var i in mc) {
    		if (typeof (mc[i]) == "movieclip") {
    			trace(i+" "+mc[i]);
    		}
    	}
    }
    doShowMC(_root);

  7. #7
    Senior Member martin47's Avatar
    Join Date
    Dec 2000
    Posts
    413
    Wow! Amazing! I believed it wasn´t possible! Thanks dawsonk, genius!
    http://www.drakon.com.ar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center