It's nothing to do with the 'a', it's the 't1' and such in quotes
that's the issue.

>>MJ> function createData():Void {
>>MJ>     this._data = new Object();
>>MJ>     this._data["a"] = new Object();
>>MJ>     this._data["a"] = {"t1":0, "t2":0}; }  // The quotes in this line are 
wrong

Won't compile.

This will:

>>MJ> function createData():Void {
>>MJ>     this._data = new Object();
>>MJ>     this._data["a"] = new Object();  // Note this line is totally 
pointless
>>MJ>     this._data["a"] = {t1:0, t2:0}; } // This line is now correct

Incidentally, the third line is completely redundant. This is correct:

>>MJ> function createData():Void {
>>MJ>     this._data = new Object();
>>MJ>     this._data["a"] = {t1:0, t2:0}; }

Because new Object() and {} are synonymous.

var data:Object=new Object();
data['a']={t1:0,t2:0};

is exactly equal to:
var data:Object=new Object();
data['a']=new Object();
data['a']['t1']=0;
data['a']['t2']=0;

which is also equal to:

var data:Object={a:{t1:0,t2:0}};

or, because Object is dynamic

var data:Object=new Object();
data.a=new Object();
data.a.t1=0;
data.a.'t2=0;

To recap - the error was putting quotes in the key names.

HTH,
 Ian
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to