In a sane world, this works as expected:
var array:Array = ['a','b','c'];
trace(array.indexOf(array[0])); // returns 0
In an insane world, this happens:
trace(Screen.screens.indexOf(Screen.screens[0])); // returns -1
... if Screen.screens
is an Array
of the available instances of Screen
, why can't that array give an accurate indexOf
one of its own children?
edit - To take it a step further, check this out:
for each(var i:Screen in Screen.screens){
for each(var j:Screen in Screen.getScreensForRectangle(this.stage.nativeWindow.bounds)){
trace(i, j, i == j); // returns false
trace(i.bounds, j.bounds, i.bounds == j.bounds); // returns false
}
}
At least one Screen
listed in Screen.screens
should be identical to a Screen
in Screen.getScreensForRectangle(this.stage.nativeWindow.bounds)
- but even if you compare the Screen.bounds
, it still doesn't match up, despite the two Rectangle
objects having the same dimensions!
Insanity, ladies and gentlemen! You don't even want to see the workaround I put together (hint: it involves comparing the values of Screen.bounds.toString()
for the contents of Screen.screens
)