now the question is (even if it maight seen silly but i don't get the
concept yet), what is the difference between declaring the variables before
methods (after the class declaration) and declaring them inside the method
itself, or even in the method parameters???

In short, declaring them on the class creates a class property, one that lives on. Declaring it inside a method creates a temporary variable that is lost once the method/function is over. 'Declaring' it on the parameter is the same.

Be careful though:

function setName(name) {
      var myName:String;
      name = myName;
}

I'm not sure what you're trying to achieve, but this method does nothing at all. It receives a parameter, creates an empty/undefined String, and assigns this empty string to the variable that has received the parameter, overwriting the parameter value. I'm not sure what you're trying to do, but you're probably not understanding how the scope chain works inside actionscript, that names are merely links to a variable, and that they aren't global. You could have several variables or proprties of the same name accessible from the same scope.


Zeh
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to