闪客动漫天地
欢迎 游客 , 注册 | 登录 | 会员 | 界面 | 简洁版本 | 在线 | 帮助
闪客动漫天地论坛

发表新主题 回复该主题
本主题被查看1279次, 共1个帖子, 1页, 当前为第1页     选择页数: 1      跳转到第   上一主题   下一主题
标题: A Bug Fixed In Flash 8 (Original In Mx 2004)...
新手上路
UID: 120402
来自:
精华: 0
积分: 4
帖子: 4
注册: 2007-6-13 13:01:00
状态: 离线
威望: 0.00
金钱: 0.85 元
只看楼主 2007-11-16 22:55
A Bug Fixed In Flash 8 (Original In Mx 2004)...
A bug in ActionScript 2.0 prevents access to inherited class properties before the superclass that defines the property is used in a script.
这是EAS2.0中"4.3.1.4 Subclasses and class properties"里面提到过的一个BUG
但是,在Flash 8里面这个BUG已经被补上了哈
於此小小通知一下,嘻嘻

For example, in the following code, the class property Employee.defaultSalary is inherited by Manager:

// Code in Employee.as

class Employee {

  public static var defaultSalary:Number = 34000;

}



// Code in Manager.as

class Manager extends Employee {

}


If, outside of the Employee and Manager classes, we attempt to access Manager.defaultSalary before referencing the Employee class, then the property will be undefined:

// Fails when this code appears outside of Employee.as and Manager.as

trace(Manager.defaultSalary);  // Displays: undefined


To fix the problem, we simply refer to the Employee class before accessing the property:

// Refer to Employee

Employee;

// Now it works

trace(Manager.defaultSalary);  // Displays: 34000


Note, however, that the inherited class property bug does not cause problems for code inside the subclass. For example, the following code in Manager works without any special reference to Employee:

class Manager extends Employee {

  function paySalary ( ):Void {

    // This reference is valid because Employee is referenced

    // in the Manager class definition.

    var salary:Number = Manager.defaultSalary;



    // Remainder of method not shown...

  }

}


上面的是书里面的原话哈
时间比较紧就没有翻译,有空回来译!!!
#1  
发表新主题 回复该主题
本主题被查看1279次, 共1个帖子, 1页, 当前为第1页     选择页数: 1      跳转到第







现在的时间是 2008-07-20 08:19:41
沪ICP备05003105号

版权所有 闪客俱乐部  
         Powered by Discuz!NT 1.0.6666    Copyright © 2001-2008 Comsenz Inc.
Processed in 0.416 seconds