# Finding all Movieclips on the stage

**URL:** <https://forum.kirupa.com/t/finding-all-movieclips-on-the-stage/329530>\
**Category:** flash\
**Created:** [September 10, 2012, 5:56pm UTC](https://forum.kirupa.com/t/finding-all-movieclips-on-the-stage/329530 "2012-09-10T17:56:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bonassus](https://avatars.discourse-cdn.com/v4/letter/b/ea5d25/32.png) [@bonassus](https://forum.kirupa.com/u/bonassus)\
**Post date:** [September 10, 2012, 5:56pm UTC](https://forum.kirupa.com/t/finding-all-movieclips-on-the-stage/329530/1 "2012-09-10T17:56:30Z")

</div>

I’m trying to understand whats happening here. when i run this code it traces all the movieclips on the stage plus “instance1” which only happens when i also include non movieclip objects on the stage. so is instance1 a automatically created movieclip?

```auto

        function addedToStageHandler(e:Event):void{
            
            var stageObject:Object = stage.getChildAt(0); 

            if(stageObject is MovieClip) {
                
                for(var j:int=0; j<stageObject.numChildren; j++) {
                    
                    var tempMc:Object = stageObject.getChildAt(j);
                    trace(tempMc.name);
                    
                    if (tempMc.name == "instance1"){
                    
                        tempMc.alpha = .3;
                        
                    }
                }
            } 
        }    

```

also when i change the:

```auto
var tempMc:Object

```

in the above code to:

```auto
var tempMc:MovieClip

```

i get a Type Coercion error  
cannot convert flash.display::Shape@6f386f51 to flash.display.MovieClip.

I don’t understand this because i’m already checking if (stageObject is MovieClip) so it seems like the for loop should be ignoring all non movieclips.

An explanation would be appreciated

thanks!
