9.2.7 Scopes

Static properties are in scope of bodies of static and instance methods of the same class. Instance properties are in scope of the bodies of the instance methods. Instance properties shadow static properties with the same name. Static properties of base classes are in scope of static and instance methods of a class.

class A 
{ 
    static var ax
}
class B extends A 
{ 
    static var bx 
}
class C extends B 
{
    static var cx  
    var ix  
    function m() 
    {
        var mx
        gx = 10
        ax = 20
        bx = 30
        cx = 40
        mx = 50
    }
}
var gx
o = new C
o.m()

Scopes:

{ mx } - activation scope

{ ix } - instance scope

{ cx } - static scope C

{ bx } - static scope B

{ ax } - static scope A

{ gx } - global scope


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/specs/actionscript/3/as3_specification78.html