objects defined in more localized scopes will always override objects defined in more global scopes.
package{ import flash.display.Sprite;
public class Main extends Sprite{ public function Main(){ var myLocal:Local = new Local(); trace(myLocal.a); // Displays: instance trace(myLocal.b); // Displays: instance
myLocal.method(); // Displays: function
} } } class Local { public var a:String = "instance"; public var b:String = "instance";
public function method():void { var a:String = "function"; b = "function"; trace(a); trace(b); } }
Related Scripts with Example Source Code in same category :