Just had some new insight on the Cast to Array problem I had posted a while ago.
For the Flash IDE compiler the following 3 lines are synonymous, i.e. creating an Array with one object in it (resulting in the problem I had in my earlier post):
Actionscript:
var a:Array = Array({x:1});
var b:Array = [{x:1}];
var c:Array = new Array( {x:1});
Not for MTASC though. MTASC seems to interpret Array() as a cast operator instead of a global conversion function. Can be tricky to debug, because for FDT and MTASC Array({x:1}) is legal syntax, namely a cast operation. They don't throw an error, but they don't create an Array either. If you have more than one element they do complain. Array(1,2,3) is illegal syntax for FDT and MTASC.
The following example class would behave differently in swf's compiled with MTASC or the Flash IDE. Which strengthens my belief that the Array() operator should better not be used at all.....
Actionscript:
class ArrayTest
{
public function ArrayTest()
{
testArray(Array({x:1}));
// Flash: Array.length: 1
// MTASC: Array.length: undefined
testArray([ {x:1} ]);
// Both: Array.length: 1
testArray(new Array( {x:1} ));
// Both: Array.length: 1
}
private function testArray(ar:Array):Void
{
trace("Array.length: "+ar.length);
}
}