Hello, yes in AS3, but I think AS2 had the same irritating issue.

Sure you can put var i:int above.

But in many other languages (like C++, Java, Perl) you write something like

for (my $i = 0; $i < 10; $i++) {
      # XXX
}

an the scope of variable is limited to the loop only.

Regards
Alex

On Tue, Dec 23, 2008 at 11:22 AM, ekameleon <ekamel...@gmail.com> wrote:
> Your code is in AS3 ?
>
> In AS3 :
>
> var i:int ; // only one
>
> for ( i = 0; i < 10; i++)
> {
>       trace('1st loop: ' + i);
> }
>
> for ( i = 0; i < 10; i++)
> {
>       trace('2nd loop: ' + i);
> }
>
> The FlashPlayer 9 or 10 optimize the variables and you must implement a
> variable one time in the same expression of code ;)
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to