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?
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:
var tempMc:Object
in the above code to:
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!