package
{
import flash.display.Sprite;
public class Test extends Sprite
{
private static var list:Vector.<int> = new Vector.<int>(10);
public function Test()
{
show();
}
public static function show():void
{
var list:Vector.<int> = list;
trace("length:" + list.length);
}
}
}
静态方法只能调用静态属性,这里红字list为类里定义的list.
因为函数内的局部变量list还没有初始化…