Funny, Danny. I'm hoping someday it will all be just one language.
- MM
You can tell that Michael is mostly a Director user, can't you? :)
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
As you have discovered you are not able to use numbers as keys in line
objects.
Trying to do what you do will however not change this. Only way to do
what you want would be to insert the indexes manually:
function createObj():Void {
this._data = new Object();
this._data[a] =
2 issues:
1) identifiers are an expression not a string ie a:hey vs a:hey. The
later will not work
2) You can not use a number as identifier in this case. The compiler catches
it and throws an error. However, you can hack it using this[1] = hello
world; trace(this[1]); but then you can use {:}
As you have discovered you are not able to use numbers as
keys in line objects.
That's not true.
Just wrote this and it works fine.
a = {};
a[a] = {};
a[a][1] = new Number(5);
trace(a[a][1]);
-- 5
Works for me. You must be doing something else wrong.
I'm not sure why you're using new
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
*can't use* {:}
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Erik Bianchi
Sent: Friday, February 09, 2007 10:25 AM
To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] Identifier expected
2 issues:
1) identifiers are an expression not a string
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
: [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
-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
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
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
, 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
Thanks everyone for the responses. This thread has been really helpful.
- MM
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by
13 matches
Mail list logo