Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-13 Thread Alexander Farber
That's a great response, thank you On Sun, Apr 12, 2009 at 10:14 PM, Juan Pablo Califano wrote: > The problem is that, while static initializer blocks look like their > counterparts in Java, they have a little but important difference. Even > though you use curly braces, you're not creating a new

Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Juan Pablo Califano
No worries, Zeh. I'm glad it was of use. Cheers Juan Pablo Califano 2009/4/12 Zeh Fernando > Many thanks for the in-depth reply, Juan. I learned something today. > > Zeh > > On Sun, Apr 12, 2009 at 5:14 PM, Juan Pablo Califano < > califa010.flashcod...@gmail.com> wrote: > > > The problem is tha

Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Zeh Fernando
Many thanks for the in-depth reply, Juan. I learned something today. Zeh On Sun, Apr 12, 2009 at 5:14 PM, Juan Pablo Califano < califa010.flashcod...@gmail.com> wrote: > The problem is that, while static initializer blocks look like their > counterparts in Java, they have a little but important

Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Juan Pablo Califano
The problem is that, while static initializer blocks look like their counterparts in Java, they have a little but important difference. Even though you use curly braces, you're not creating a new scope. In AS, scope is either class / global or local (to a function or method). So, you cannot declar

Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Karl DeSaulniers
or dont delare the ":int" part and just put i=0 I'm just guessing now.. sry Karl DeSaulniers Design Drumm http://designdrumm.com On Apr 12, 2009, at 4:58 AM, Alexander Farber wrote: On Sun, Apr 12, 2009 at 11:46 AM, Karl DeSaulniers wrote: //for (var i:uint = 0; i < 10; i++) for (var i:int

Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Karl DeSaulniers
Maybe try just: { var i:int; for (i = 0; i < 10; i++) trace(i); } no need to declare the "var" part twice on the same variable. Karl DeSaulniers Design Drumm http://designdrumm.com On Apr 12, 2009, at 4:58 AM, Alexander Farber wrote: On Sun, Apr 12, 2009 at 11:46 AM,

Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Alexander Farber
Oops a typo: On Sun, Apr 12, 2009 at 11:58 AM, Alexander Farber wrote: > Nope this doesn't change anything and also > > { >      var i:int; >      for (i = 0; i < 10; i++) >            trace(i); > } > > won't work ___ Flashcoders mailing list Flashcode

Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Alexander Farber
On Sun, Apr 12, 2009 at 11:46 AM, Karl DeSaulniers wrote: > //for (var i:uint = 0; i < 10; i++) > for (var i:int = 0; i < 10; i++) Nope this doesn't change anything and also { var i:int; for (var i:int = 0; i < 10; i++) trace(i); } won't work Regards Alex __

Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Karl DeSaulniers
I am not a AS3 coder, but shouldn't this part be like this? //for (var i:uint = 0; i < 10; i++) for (var i:int = 0; i < 10; i++) Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http:/

[Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Alexander Farber
Hello, I have a static initializer in my class and it works ok: private static var BLACK:TextFormat = new TextFormat('Arial', 24, 0x00, true); private static var RED:TextFormat = new TextFormat('Arial', 24, 0xFF, true); // place "1" closer to "0" in the "10" string { BLACK.lette