dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Find children of movieclips in as2

  1. #1
    Senior Member
    Join Date
    Apr 2001
    Posts
    211

    Find children of movieclips in as2

    I know you can do this in as3 pretty easily, but is there a way to get a list of all the children in a moviclip in as2?
    -FRIG-5
    Das Konzept Design
    www.daskonzept.com

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    yep, suppose your movieclip has an instance name mc, then the following will do the trick:

    Code:
    getAllBabies(mc); 
    
    function getAllBabies(movie:MovieClip):Void {
    	for (var i:String in movie) {
    		if (movie[i] instanceof MovieClip) {
    			trace(movie[i]);
    			getAllBabies(movie[i]);
    		}
    	}
    }
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  3. #3
    Senior Member
    Join Date
    Apr 2001
    Posts
    211
    cute. Thanks. I love getting all the babies.
    -FRIG-5
    Das Konzept Design
    www.daskonzept.com

  4. #4
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    lol your welcome
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

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