In the following code:
for each (var h:Hero in heroes as Hero)
{
if (h.type == 0) DoSomething(h);
}
I receive the error: **Warning: Implicit downcast from ‘Object’ to ‘Hero’.
Hero is a custom class of mine:
class Hero {
public var myName:String;
public var type:int;
function Hero() {
}
}
And the Array declaration:
public var heroes:Array = new Array();
How can I cast the return type of the for each statement to stop that warning?