views:

17

answers:

1

I have the following line in some of my haxe code:

removeChild(_screens[Helpers.indexOf(_screenNames, _activeScreen)]);

(_screens is a List, GameScreen is extending from Sprite, _activeScreen is a String, _screenNames is a List, and Helpers.indexOf does the obvious)

However, i get the error:

List<com.haxelib.GameScreen> should be Array<Unknown<0>>

on the _screens part. I can't make sense of this error; what does it mean?

+1  A: 

List does implement ArrayAccess and thus cannot be used with the square brackets syntax. You should use _screens.get(index) instead. Also you don't say if your Helpers.indexOf takes an Array, a List or an Iterable as argument ... if it takes an Array it cannot be used with a List; the best way is to use Iterable so it can take both arrays or lists.

Franco Ponticelli
Hlpers.IndexOf takes a list. I also presume you mean List *doesn't* implement ArrayAccess? Thanks for the help! Edit: checking the available methods, there's no `get` method on List<T> (i'm using the generic version).
RCIX
In any case, i implemented a `itemAtIndex` function, which does what i need.
RCIX