For Loop Isn't Running Correctly
I have some code for an RPG battle system where, when the menu's attack button is pressed, the code goes through all the stages children, determines which are linked to the class Enemy, and then adds an event listener to each one.
function targetParse():void{
for(var i:uint = 0; i < stage.numChildren; i++){
var enemy:Object = stage.getChildAt(i);
trace('enemy identified')
if(enemy is Enemy){
trace('its an enemy')
enemy.addEventListener(MouseEvent.MOUSE_OVER, arrowControl);
trace('listener added')
}
else{}
}
}
All these trace statements are for debugging. It gets to 'enemy identified' but doesn't seem to be running the if statement.
I think it's probably my syntax.
