Re: [Flashcoders] Why does this work?!

2007-04-17 Thread Andy Herrman
Oh, it works correctly, assuming I'm not dumb and give a couple "constants" the same values. It just seems strange for this to be allowed. Thus the question "why does this work". I would think it shouldn't even compile. -Andy On 4/17/07, Hans Wichman <[EMAIL PROTECTED]> wrote: Hi, what were

Re: [Flashcoders] Why does this work?!

2007-04-17 Thread eka
Hello :) in AS2 you can create constants with the ASSetProgFlags global method : public static var CONNECTED:String = "CONNECTED" ; public static var FAILURE:String= "FAILURE" ; public static var NOT_CONNECTED:String = "NOT_CONNECTED"; private static var __ASPF__ = _glo

Re: [Flashcoders] Why does this work?!

2007-04-17 Thread Hans Wichman
Hi, what were your own test results? :) Yes you can do this, and flash will execute the first matching case statement. Any other matches will be ignored. greetz JC On 4/17/07, Andy Herrman <[EMAIL PROTECTED]> wrote: I just realized that there are a number of switch statements in my code whic

[Flashcoders] Why does this work?!

2007-04-17 Thread Andy Herrman
I just realized that there are a number of switch statements in my code which probably shouldn't work, yet appear to, and I'm wondering why. Here's a really simple example. I have a class that tracks the connection state of my app, with the following values used as the states (read-only attribut

Re: [Flashcoders] Why does this work?!

2007-04-17 Thread Andy Herrman
Oh, the code is OK, and it works. I'm just surprised Flash lets you have case statements with non-constant values. Since the case values are actually functions that are evaluated it's possible that you can have multiple case statements of the same value. I'm not used to languages/compilers allo

RE: [Flashcoders] Why does this work in Flash 6 Actionscript 2 butnot Flash 7 Actionscript 2 ...

2006-12-11 Thread Steven Sacks | BLITZ
> > Why does the following work when published as Flash 6 > Actionscript 2, but not Flash 7 actionscript 2 (or Flash 8 > Actionscript 2).var nInt:Number;var oMain:Object = {};var > nCounter:Number;var sClipName:String;var > nClipDepth:Number;function spawnClip():Void{var > mcTemp:MovieClip

Re: [Flashcoders] Why does this work in Flash 6 Actionscript 2 but not Flash 7 Actionscript 2 ...

2006-12-11 Thread Jake Prime
Hi Stephen, You are incrementing nCounter without ever initializing it. In Flash 6 and earlier if you incremented an undefined value it treated it as 0, but in Flash 7 and later it remains undefined. Set nCounter to 0 first and all should be well. Jake On 11/12/06, Stephen Ford <[EMAIL PROTECTE

[Flashcoders] Why does this work in Flash 6 Actionscript 2 but not Flash 7 Actionscript 2 ...

2006-12-11 Thread Stephen Ford
Why does the following work when published as Flash 6 Actionscript 2, but not Flash 7 actionscript 2 (or Flash 8 Actionscript 2).var nInt:Number;var oMain:Object = {};var nCounter:Number;var sClipName:String;var nClipDepth:Number;function spawnClip():Void{var mcTemp:MovieClip = this.attachM