[Flashcoders] Identifier expected

2007-02-09 Thread Mendelsohn, Michael
Hi list...

Simple question -- why doesn't the 2nd line work?  The identifier
expected error is traced at compile time.

Thanks,
- Michael M.


function createObj():Void {
this._data = new Object();
this._data["a"] = {"1":new Number(0), "2":new Number(0), "3":new
Number(0)}; 
}
___
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


Re: [Flashcoders] Identifier expected

2007-02-09 Thread Chris Benjaminsen
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"] = new Object();
this._data["a"][1] = new Number(0)

}




Mendelsohn, Michael wrote:

Hi list...

Simple question -- why doesn't the 2nd line work?  The identifier
expected error is traced at compile time.

Thanks,
- Michael M.


function createObj():Void {
this._data = new Object();
this._data["a"] = {"1":new Number(0), "2":new Number(0), "3":new
Number(0)}; 
}

___
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


RE: [Flashcoders] Identifier expected

2007-02-09 Thread Erik Bianchi
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 {:} type syntax.

-erik

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mendelsohn,
Michael
Sent: Friday, February 09, 2007 10:09 AM
To: Flashcoders mailing list
Subject: [Flashcoders] Identifier expected

Hi list...

Simple question -- why doesn't the 2nd line work?  The identifier
expected error is traced at compile time.

Thanks,
- Michael M.


function createObj():Void {
this._data = new Object();
this._data["a"] = {"1":new Number(0), "2":new Number(0), "3":new
Number(0)}; 
}
___
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


RE: [Flashcoders] Identifier expected

2007-02-09 Thread Steven Sacks | BLITZ
> 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 Number().  I don't think I've ever
used that.  Ever.
___
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


RE: [Flashcoders] Identifier expected

2007-02-09 Thread Merrill, Jason
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.

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 1:09 PM
>>To: Flashcoders mailing list
>>Subject: [Flashcoders] Identifier expected
>>
>>Hi list...
>>
>>Simple question -- why doesn't the 2nd line work?  The 
>>identifier expected error is traced at compile time.
>>
>>Thanks,
>>- Michael M.
>>
>>
>>function createObj():Void {
>>  this._data = new Object();
>>  this._data["a"] = {"1":new Number(0), "2":new 
>>Number(0), "3":new Number(0)}; } 
>>___
>>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


RE: [Flashcoders] Identifier expected

2007-02-09 Thread Erik Bianchi
*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 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 {:} type syntax.

-erik

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mendelsohn,
Michael
Sent: Friday, February 09, 2007 10:09 AM
To: Flashcoders mailing list
Subject: [Flashcoders] Identifier expected

Hi list...

Simple question -- why doesn't the 2nd line work?  The identifier
expected error is traced at compile time.

Thanks,
- Michael M.


function createObj():Void {
this._data = new Object();
this._data["a"] = {"1":new Number(0), "2":new Number(0), "3":new
Number(0)}; 
}
___
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


RE: [Flashcoders] Identifier expected

2007-02-09 Thread Mendelsohn, Michael
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


RE: [Flashcoders] Identifier expected

2007-02-09 Thread Steven Sacks | BLITZ
private function createData():Void 
{
this._data = {a:{t1:0, t2:0}};
}

One line.  :)


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf 
> Of Mendelsohn, Michael
> Sent: Friday, February 09, 2007 11:02 AM
> 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


RE: [Flashcoders] Identifier expected

2007-02-09 Thread Merrill, Jason
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


Re: [Flashcoders] Identifier expected

2007-02-09 Thread Ian Thomas

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


RE: [Flashcoders] Identifier expected

2007-02-09 Thread Merrill, Jason
Right,  But "a" is not an object.  If you follow the thread, you will
see that's' what he's trying to do.  There IS something wrong with:

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

createData()
trace(this._data.a)

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


RE: [Flashcoders] Identifier expected

2007-02-09 Thread Merrill, Jason
>>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


RE: [Flashcoders] Identifier expected

2007-02-09 Thread Mendelsohn, Michael
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 Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Identifier expected

2007-02-12 Thread Danny Kodicek
 
> Hi list...
> 
> Simple question -- why doesn't the 2nd line work?  The 
> identifier expected error is traced at compile time.
> 
> Thanks,
> - Michael M.
> 
> 
> function createObj():Void {
>   this._data = new Object();
>   this._data["a"] = {"1":new Number(0), "2":new 
> Number(0), "3":new Number(0)}; } 

You can tell that Michael is mostly a Director user, can't you? :)

In Lingo, we have property lists, which can use strings or numbers as
properties. So ["1":0, "2":0, "3":0] would be a valid Lingo propList, but
ActionScript isn't quite the same, as others have explained. My guess is
that you're trying to match an AS list to a Lingo list without worrying
about the fact that Lingo lists are 1-based rather than 0-based. A simpler
solution would be to use a Flash array where the first element is 0.

Danny

___
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


RE: [Flashcoders] Identifier expected

2007-02-12 Thread Mendelsohn, Michael
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:
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


Re[2]: [Flashcoders] Identifier expected

2007-02-09 Thread R�kos Attila

MJ> That's because you're still not refrencing an object that exists:
MJ> 
>>>this._data["a"] = new Object();
MJ> 
MJ> You're saying, Hey, _data, make your "a" property an object.  But Flash
MJ> is saying, hold on cowboy, I don't see any property of _data called "a".

You are not right, it is totally acceptable and correct, I think you
are mixing something up :)

  Attila

___
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


Re[2]: [Flashcoders] Identifier expected

2007-02-09 Thread R�kos Attila

MJ> OK, I see, so then curious why this script returns compiler errors:
MJ> 
MJ> function createData():Void {
MJ> this._data = new Object();
MJ> this._data["a"] = new Object();
MJ> this._data["a"] = {"t1":0, "t2":0};
MJ> }

Because when using the object initializer operator, you cannot use
strings as identifiers (similarly to variable declaration).
In the above script the this._data["a"] = new Object(); line is simply
not necessary, and the right syntax of the last one is:

this._data["a"] = {t1:0, t2:0};

or even better:

this._data.a = {t1:0, t2:0};

  Attila

___
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


RE: Re[2]: [Flashcoders] Identifier expected

2007-02-09 Thread Merrill, Jason
>>You are not right, it is totally acceptable and correct, I 
>>think you are mixing something up :)

I understand what you're saying, but in context of what he's trying to do 
(inline object declaration), explain the compiler error on this code:

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

createData();


So instead, this is ugly, but works:

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

createData();


Jason Merrill
Bank of America 
Learning & Organizational Effectiveness
 
 
 
 
 
 

>>-Original Message-
>>From: [EMAIL PROTECTED] 
>>[mailto:[EMAIL PROTECTED] On Behalf 
>>Of Rákos Attila
>>Sent: Friday, February 09, 2007 2:31 PM
>>To: Flashcoders mailing list
>>Subject: Re[2]: [Flashcoders] Identifier expected
>>
>>
>>MJ> That's because you're still not refrencing an object that exists:
>>MJ> 
>>>>>this._data["a"] = new Object();
>>MJ> 
>>MJ> You're saying, Hey, _data, make your "a" property an object.  But 
>>MJ> Flash is saying, hold on cowboy, I don't see any property 
>>of _data called "a".
>>
>>You are not right, it is totally acceptable and correct, I 
>>think you are mixing something up :)
>>
>>  Attila
>>
>>___
>>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


Re: SPAM-LOW: [Flashcoders] Identifier expected

2007-02-09 Thread Derek Vadneau
Wow, a lot of misinformation here gents.

this._data["a"] = {"1":new Number(0), "2":new Number(0), "3":new
Number(0)};

When creating a new object using this syntax the property names are 
considered strings. Adding the quotes is what is causing the issue. If you 
remove the quotes the compiler will still complain because you can start a 
property value with a number, unless you use the [] syntax for creating a 
property. In that case you can use anything you want, even non-printable 
characters.

"
> 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]);
"

The quote was "in line objects", so the statement was true. What you did 
was take the "in line objects" and represent it in a different manner.

"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."

No, he wasn't.

this._data = new Object(); // Fine
this._data["a"] = {}; // Still fine

this._data was created, then this._data.a is created afterwards using the 
{} syntax instead of new Object().

That's why this still produces errors:
"
private function createData():Void {
this._data = new Object();
this._data["a"] = new Object();
this._data["a"] = {"t1":0, "t2":0};
}
"

If you MUST have numbers as the property values, use Chris Benjaminsen's 
version:

function createObj():Void {
this._data = new Object();
this._data["a"] = new Object();
this._data["a"][1] = new Number(0)
...
}


Derek Vadneau

- Original Message - 
From: "Mendelsohn, Michael" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" 
Sent: Friday, February 09, 2007 1:08 PM
Subject: SPAM-LOW: [Flashcoders] Identifier expected


Hi list...

Simple question -- why doesn't the 2nd line work?  The identifier
expected error is traced at compile time.

Thanks,
- Michael M.


function createObj():Void {
this._data = new Object();
this._data["a"] = {"1":new Number(0), "2":new Number(0), "3":new
Number(0)};
}


___
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


RE: Re[2]: [Flashcoders] Identifier expected

2007-02-09 Thread Steven Sacks | BLITZ
Stop using new Object() and use {};
 
:)

I'm not experiencing the same issue you're having Jason.  Not sure why.

___
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


RE: Re[2]: [Flashcoders] Identifier expected

2007-02-09 Thread Merrill, Jason
I didn't even notice that in the script before - should have been obvious. 
Sorry for the noise.

Jason Merrill
Bank of America 
Learning & Organizational Effectiveness
 
 
 
 
 
 

>>-Original Message-
>>From: [EMAIL PROTECTED] 
>>[mailto:[EMAIL PROTECTED] On Behalf 
>>Of Rákos Attila
>>Sent: Friday, February 09, 2007 3:13 PM
>>To: Flashcoders mailing list
>>Subject: Re[2]: [Flashcoders] Identifier expected
>>
>>
>>MJ> OK, I see, so then curious why this script returns 
>>compiler errors:
>>MJ> 
>>MJ> function createData():Void {
>>MJ> this._data = new Object();
>>MJ> this._data["a"] = new Object();
>>MJ> this._data["a"] = {"t1":0, "t2":0}; }
>>
>>Because when using the object initializer operator, you 
>>cannot use strings as identifiers (similarly to variable declaration).
>>In the above script the this._data["a"] = new Object(); line 
>>is simply not necessary, and the right syntax of the last one is:
>>
>>this._data["a"] = {t1:0, t2:0};
>>
>>or even better:
>>
>>this._data.a = {t1:0, t2:0};
>>
>>  Attila
>>
>>___
>>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


Re: Re[2]: [Flashcoders] Identifier expected

2007-02-09 Thread Ian Thomas

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


Re: Re[2]: [Flashcoders] Identifier expected

2007-02-09 Thread Ian Thomas

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


Whoops - a stupid stray quote in the last line. Should of course have been:
data.a.t2=0;

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