I am trying to define an array with single element… so,
var arr:Array = new Array(1,2,3,4) // arr[0] = 1
// but
var arr:Array = new Array(1) // arr[0] = undefined
//Also,
var arr:Array = new Array([1]) // arr[0] = 1 , << ILLUSION
//Because, arr[0] is NOT A NUMBER, IT ITSELF IS OF TYPE=> ARRAY.
var arr:Array = [1] //arr[0]=1 but i think it's AS1.0 notation..
So, is their any AS3.0 way of defining array with single element ?
Why? This is perfectly legal shorthand array initialization, and it’s exactly the way to do it.