dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Counting the number of mc's on stage

  1. #1
    Captain
    Join Date
    Oct 2005
    Posts
    63

    Counting the number of mc's on stage

    How can I count the number of movieclips on stage by actionscript?

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    PHP Code:
    var noOfClips:Number 0;
    count(_root); 

    function 
    count(movie:MovieClip):Void {
        
        for (var 
    i:String in movie) {
            
    trace(movie[i]);

            if (
    movie[i] instanceof MovieClip) {
                
    noOfClips++;
            }
        }
        
    trace("there are " noOfClips " movieclips on stage");


    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