views:

29

answers:

2

Sorry, I'm new to flash I have this line of code:

            BaseEntry( _entryList[i] ).topTeamName = ((Team)(teamList.getNameAtIndex( i*2 ))).Name;

and I get the error:

TypeError: Error #1034: Type Coercion failed: cannot convert "[object Team]" to ncaa.Data.Team.

What do I need to do to fix it?

+1  A: 

I think what you're looking for is, instead of:

((Team)(teamList.getNameAtIndex( i*2 ))).Name

you want:

(teamList.getNameAtIndex( i*2 ) as Team).Name
walpolea
+1  A: 

@walpolea is right... but for the sake of completeness you can also do it this way:

BaseEntry( _entryList[i] ).topTeamName = Team(teamList.getNameAtIndex(i*2)).Name;

which many argue is faster then using "as".

heavilyinvolved