>>There's nothing wrong with saying:
>>
>>var data:Object=new Object();
>>data['a']="something";
>>
>>Try it.

OK, I see, so then curious why this script returns compiler errors:

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

createData()
trace(this._data.a)

Seems to be something wrong with that. 

Jason Merrill
Bank of America 
Learning & Organizational Effectiveness
 
 
 
 
 
 

>>-----Original Message-----
>>From: [EMAIL PROTECTED] 
>>[mailto:[EMAIL PROTECTED] On Behalf 
>>Of Ian Thomas
>>Sent: Friday, February 09, 2007 2:47 PM
>>To: Flashcoders mailing list
>>Subject: Re: [Flashcoders] Identifier expected
>>
>>Uh, Jason.
>>
>>There's nothing wrong with saying:
>>
>>var data:Object=new Object();
>>data['a']="something";
>>
>>Try it.
>>
>>Ian
>>
>>On 2/9/07, Merrill, Jason <[EMAIL PROTECTED]> wrote:
>>> That's because you're still not refrencing an object that exists:
>>>
>>> >>this._data["a"] = new Object();
>>>
>>> You're saying, Hey, _data, make your "a" property an object.  But 
>>> Flash is saying, hold on cowboy, I don't see any property 
>>of _data called "a".
>>>
>>>
>>> So instead:
>>>
>>> private function createData():Void {
>>>         this._data = new Object();
>>>         this._data.a = new Object();
>>>         this._data.a = {"t1":0, "t2":0}; }
>>>
>>> Or use the one-liner Steve just posted, which is intead, an 
>>explicit 
>>> declaration.  I use that one commonly.
>>>
>>>
>>> Jason Merrill
>>> Bank of America
>>> Learning & Organizational Effectiveness
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> >>-----Original Message-----
>>> >>From: [EMAIL PROTECTED]
>>> >>[mailto:[EMAIL PROTECTED] On Behalf Of 
>>> >>Mendelsohn, Michael
>>> >>Sent: Friday, February 09, 2007 2:02 PM
>>> >>To: Flashcoders mailing list
>>> >>Subject: RE: [Flashcoders] Identifier expected
>>> >>
>>> >>Thanks Jason.  I see what you're saying.  So I inited an 
>>object and 
>>> >>then define it, but the below still errors.  I was just 
>>hoping to be 
>>> >>able to define my object with only one line of code.
>>> >>
>>> >>private function createData():Void {
>>> >>      this._data = new Object();
>>> >>      this._data["a"] = new Object();
>>> >>      this._data["a"] = {"t1":0, "t2":0}; }
>>> >>
>>> >>
>>> >>I was using new Number for a reason, but it's not 
>>critical I suppose.
>>> >>Thanks Steven.
>>> >>
>>> >>- Mike
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>The second line does not work because you are evaluating 
>>a string to 
>>> >>try to resolve it to a property of the object, (which you 
>>are hoping 
>>> >>is a
>>> >>sub-object) that does not exist yet.  In other words,
>>> >>
>>> >>this._data.a
>>> >>
>>> >>the .a in the above statement has not been declared or 
>>identified as 
>>> >>an object, and thus this._data["a"] resolves to nothing.
>>> >>_______________________________________________
>>> >>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
>>> >>
>>> _______________________________________________
>>> 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
>>>
>>_______________________________________________
>>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
>>
_______________________________________________
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