RandoriAS / randori-compiler

Compiler for Randori ActionScript Project
http://randoriframework.com/
20 stars 9 forks source link

Bug or JS/AS3 limitation: Initilizing Array/Vector #166

Closed renaun closed 11 years ago

renaun commented 11 years ago

AS3 Code:

var nums:Vector.<Number> = new Vector.<Number>(10);
var objs:Vector.<Object> = new Vector.<Object>(10);

Outputted JS:

this.nums = [10];
this.objs = [10];

But it really should be something like this:

this.nums = [0,0,0,0,0,0,0,0,0,0];
this.objs = [null,null,null,null,null,null,null,null,null,null];
teotigraphix commented 11 years ago

Well for a Vector, I know exactly where that is, is the length the only possible arg or can you pass and array also? I forget (I would have to look at the language ref :) ).

renaun commented 11 years ago

You can pass in an array to initialize it, so there is a case there too

var vector:Vector. = Vector.(["v1", "v2", "v3"]);

teotigraphix commented 11 years ago

commit ee78d0a