Explain this 'Error #1034' in my 'for each' loop

Hey all,

I’m getting a “error #1304: Type Coercion failed” error when I try to run the following code:


public class BattleController extends MovieClip {
        public var god:God;
        public var conRoomToKill:ConRoom;
        public var player0:PlayerBattle;
        public var player1:PlayerBattle;
        public var player2:PlayerBattle;
        public var arObject:Array;

        
        public function BattleController(vC:RoomController) {
            var i:int;
            conRoomToKill=vC;
            god=vC.god;
            
            arObject = new Array();
            
            createRoomObjects();
        }

public function createRoomObjects():void {
            player0 = new PlayerBattle(this,0);
            addChild(player0);
            
            player1 = new PlayerBattle(this,1);
            addChild(player1);
            
            player2 = new PlayerBattle(this,2);
            addChild(player2);
            
            arObject.push(player0);
            arObject.push(player1);
            arObject.push(player2);
            
            for each (var vO:PlayerBattle in arObject) {
                   vO.mHealth+=10;
            }
        }


The error seems to be in the “var vO: PlayerBattle” section. I thought that this was good code, but obviously it ain’t or my understanding of how things work is wrong.

So, based on the information I’ve read, it seems like vO: PlayerBattle is not the right data type in arObject. But, how could that be?

Any help or a point in the right direction would be really appreciated!