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

Reply via email to