Re: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-07-01 Thread Allandt Bik-Elliott (Receptacle)
should that be:? var clip:* = e.target; var buttons:Array = _menuButtons; (e.target.buttonType == 1) ? buttons = _subMenuButtons : buttons = _menuButtons; On 1 Jul 2008, at 00:03, Steven Sacks wrote: Even better, 3 lines. var clip:* = e.target; var buttons:Array = _menuButtons; if

Re: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-07-01 Thread Steven Sacks
Why? You already set buttons to _menuButtons. Now you're going to set it again? Besides, that ternary is not DRY because you are setting buttons = twice. However, it can be compacted even more, and in 2 lines, instead of 3, by reusing clip and a ternary in the var declaration, like so:

Re: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-07-01 Thread Allandt Bik-Elliott (Receptacle)
nice! ;) On 1 Jul 2008, at 08:37, Steven Sacks wrote: Why? You already set buttons to _menuButtons. Now you're going to set it again? Besides, that ternary is not DRY because you are setting buttons = twice. However, it can be compacted even more, and in 2 lines, instead of 3, by

RE: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-07-01 Thread Kerry Thompson
Steven Sacks: var clip:* = e.target; var buttons:Array = (clip.buttonType == 1) ? _subMenuButtons: _menuButtons; Nice, Steve. One syntax question--the use of clip:* Before I sent my original response to the post, I tried var clip = e.target. Of course, it failed without the type * I

Re: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-07-01 Thread Geografiek
It's a wildcard I think. clip can be of any type. Willem Op 1-jul-2008, om 12:10 heeft Kerry Thompson het volgende geschreven: Steven Sacks: var clip:* = e.target; var buttons:Array = (clip.buttonType == 1) ? _subMenuButtons: _menuButtons; Nice, Steve. One syntax question--the use of

RE: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-07-01 Thread Kerry Thompson
Geografiek wrote: It's a wildcard I think. clip can be of any type. That's what I suspected. What is the advantage, then, of using the wildcard, rather than an untyped variable? I don't mean to sound argumentative--I'm just trying to understand one of ActionScript's nooks and crannies.

RE: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-07-01 Thread Eamonn Faherty
Sent: 01 July 2008 11:42 To: 'Flash Coders List' Subject: RE: [Flashcoders] Warning: 3596: Duplicate variable definition. Geografiek wrote: It's a wildcard I think. clip can be of any type. That's what I suspected. What is the advantage, then, of using the wildcard, rather than an untyped

Re: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-07-01 Thread Geografiek
Hi Kerry, I understand you got an error not typing your variable in 'var clip = e.target;' I tried 'var type = myType;', which gave no error. Appearantly in some cases you _need_ to type a variable, in other cases you don't (!?) In my case Flash automatically assigns String as the data type

RE: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-07-01 Thread Merrill, Jason
That's what I suspected. What is the advantage, then, of using the wildcard, rather than an untyped variable? Gotta think outside the IDE :) because in the Flex world for example, depending on how you have the compiler set, it will complain if you don't typecast a variable (even if you are only

RE: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-07-01 Thread Merrill, Jason
:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Tuesday, July 01, 2008 10:58 AM To: Flash Coders List Subject: RE: [Flashcoders] Warning: 3596: Duplicate variable definition. That's what I suspected. What is the advantage, then, of using the wildcard, rather than an untyped variable? Gotta

Re: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-07-01 Thread Paul Andrews
Of Merrill, Jason Sent: Tuesday, July 01, 2008 10:58 AM To: Flash Coders List Subject: RE: [Flashcoders] Warning: 3596: Duplicate variable definition. That's what I suspected. What is the advantage, then, of using the wildcard, rather than an untyped variable? Gotta think outside the IDE :) because

RE: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-07-01 Thread Merrill, Jason
internal GTO Innovative Learning Blog subscribe. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of eric e. dolecki Sent: Tuesday, July 01, 2008 12:26 PM To: Flash Coders List Subject: Re: [Flashcoders] Warning: 3596: Duplicate variable definition

Re: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-07-01 Thread Steven Sacks
Kerry, You should turn Strict mode on your FLAs in the publish profile settings. If you click on the language (the place you set your class paths and if you want Flash to auto-declare stage instances), you should see a checkbox for strict mode. Turn it on. The reason you want strict mode

RE: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-07-01 Thread Kerry Thompson
Steven Sacks wrote: You should turn Strict mode on your FLAs in the publish profile settings. No problem there--it's one of the first things I did when I got CS3. I LIKE strict typing, for all the reasons you mentioned. In fact, lack of typing in Lingo is one of my biggest complaints about

RE: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-06-30 Thread Kerry Thompson
Pavel KruĊĦek wrote: I have written a script, here is piece of some method: private function resetState( e:Event ) { switch(e.target.buttonType) { case 0 : var clip = e.target as

Re: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-06-30 Thread Steven Sacks
You see that you're declaring clip (and buttons) twice (causing the error), and as two different types (not causing the error but will cause another shortly). Because you want one variable to act as either a Main or Sub, you need to either cast clip as an abstract version that both of those

RE: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-06-30 Thread Kerry Thompson
private function resetState( e:Event ) { var clip; var buttons:Array; switch(e.target.buttonType) { case 0 : clip = e.target as MenuButtonMain; buttons = _menuButtons; break; case 1 :

Re: [Flashcoders] Warning: 3596: Duplicate variable definition.

2008-06-30 Thread Steven Sacks
Even better, 3 lines. var clip:* = e.target; var buttons:Array = _menuButtons; if (e.target.buttonType == 1) buttons = _subMenuButtons; ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com