Try this:

for(var i:int; i<10; i++) {
   //some crap here....
}

On Mon, Mar 24, 2008 at 8:49 PM, Kerry Thompson <[EMAIL PROTECTED]>
wrote:

> jonathan howe wrote:
>
> > Hmm... it is within a class... and that's when I'm getting the warnings.
> Or
> > did you mean just in general to reiterate that variables are locally
> scoped
> > to functions and classes and not to for loops?
>
> If you declare a variable within a function, its scope is limited to that
> function. It really doesn't relate to where in the function you use it (or
> declare it). In my example, this:
>
> function doSomething
> {
>   var i:int;
>   for(i=0;i++;i<10)
>   {
>   }
> }
>
> Is functionally identical to this:
>
> function doSomething
> {
>   for(var i:int =0;i++;i<10)
>   {
>   }
> }
>
> You're correct that AS3 is more strict about these sorts of things than
> AS2.
> AS2 was really just syntactic sugar for AS1, and wasn't strict at all.
>
> Cordially,
>
> Kerry Thompson
>
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
Omar M. Fouad - Digital Emotions
http://www.omarfouad.net

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to