Flex_ActionScript3.0——编译警告【2】

作者在 2010-03-02 16:43:10 发布以下内容
代码 消息 说明
  1009 %s '%s' has no type declaration. 不声明数据类型是一种个人编码风格偏好。函数的返回类型、参数或变量没有类型声明。但如果使用类型声明,编译器就可以编写出更为有效的代码并且在编译时检测到更多的错误。如果要在无法使用类型声明时得到提示,可以启用此警告。
  1013 Variables of type %s cannot be undefined. The value undefined will be type coerced to %s before comparison. 只有类型为 * 的变量才能为 undefined。未初始化的变量的默认值是 null(而不是 undefined),但有几种例外情况。例外包括:Boolean 变量,其默认值为 false;Number 变量,其默认值为 NaN;int 或 uint 变量,其默认值为 0
  1031 Migration issue: Result of new %s will be the return value of %s, rather than a new instance of that function. 这是一个代码迁移警告。在 ActionScript 3.0 和 ActionScript 2.0 中,检测到的代码具有不同的行为,如以下示例所示:
function f(){
this.b = 22;
this.a = new Array(2);?
this.a[0] = 33;
this.a[1] = 44;
return a;
}
// returns a new instance of f in ActionScript 2.0 and a new 2 element array in ActionScript 3.0
var d = new f();? // Warning here
trace(d.a); // undefined in ActionScript 3.0, [33,44] in ActionScript 2.0.
  1035 Use of Boolean() with no arguments. 这是一个代码迁移警告。Boolean() 函数在 ActionScript 3.0 中返回 false,但在 ActionScript 2.0 中返回 undefined
  1039 Migration issue: When the Number('') function is called with an empty string argument it returns 0 in ActionScript 3.0, and NaN in ActionScript 2.0. 这是一个代码迁移警告。使用 String 参数调用的 Number() 方法会跳过该字符串中的所有空白,并在检测不到数字时返回默认值 0。在 ActionScript 2.0 中,该字符串中的任何空白都会导致结果为 NaN。
  1045 Migration issue: Array.toString() handling of null and undefined elements has changed. 这是一个代码迁移警告。在 ActionScript 2.0 中,null 数组元素转换为 null,而 undefined 元素转换为 undefined。在 ActionScript 3.0 中,nullundefined 元素都转换为空字符串 ''。如果您的代码可以分析 Array 中的 toString() 输出,您可能需要针对这一区别对代码进行调整。
  1059 Migration issue: The property %s is no longer supported. %s. 这是一个代码迁移警告。ActionScript 3.0 中不存在您正在尝试使用的属性。
  1061 Migration issue: The method %s is no longer supported. %s. 这是一个代码迁移警告。ActionScript 3.0 中不存在您正在尝试使用的方法。
  1066 __resolve is no longer supported.  
  1067 Migration issue: __resolve is no longer supported. Use the new Proxy class for similar functionality. 这是一个代码迁移警告。有关替换 __resolve 的详细信息,请参阅本语言参考中的 Proxy。
  1071 Migration issue: _level is no longer supported. For more information, see the flash.display package. 这是一个代码迁移警告。ActionScript 3.0 中不存在您正在尝试使用的属性。
  1073 Migration issue: %s is not a dynamic class. Instances cannot have members added to them dynamically. 这是一个代码迁移警告。在 ActionScript 2.0 中,许多类(如 Number)都是动态的,这意味着可以在运行时向这些类的实例中添加新属性。如果代码尝试向非动态类的实例中添加属性,就会生成此警告。
  1083 Migration issue: Method %s will behave differently in ActionScript 3.0 due to the change in scoping for the this keyword. See the entry for warning 1083 for additional information. 这是一个代码迁移警告。将对象的方法作为值(通常是作为回调函数)使用时,就会生成此警告。在 ActionScript 2.0 中,在调用函数的上下文中执行函数;在 ActionScript 3.0 中,始终在定义函数的上下文中执行函数。因此,变量和方法的名称将被解析为回调函数所属的类,而不是与调用该函数的上下文有关的类,如下例所示:
class a 
{
var x;
function a() { x = 1; }
function b() { trace(x); }
}

var A:a = new a();
var f:Function = a.b; // warning triggered here
var x = 22;
f(); // prints 1 in ActionScript 3.0, 22 in ActionScript 2.0
  1085 %s will be scoped to the default namespace: %s internal. It will not be visible outside of this package. 不声明命名空间是一种个人编码风格偏好。如果要在忘记声明定义的命名空间或访问说明符时得到提示,可以启用此警告。如果没有命名空间或访问说明符两者之一,该定义对于此文件之外的代码就是不可见的。若要使该定义对于此文件之外的代码是可见的,请使用访问说明符 public 或命名空间声明对该定义进行声明。若要使该定义的作用范围仅限于此文件并避免生成此警告,请将该定义声明为 private
  1087 Migration issue: ActionScript 3.0 iterates over an object's properties within a "for x in target" statement in random order. 这是一个代码迁移警告。在 ActionScript 2.0 中,对象属性的处理顺序始终不变; 在 ActionScript 3.0 中,这个顺序是随机的,可因计算机而异。如果出现意外的排序行为,请检查此循环,确定此行为更改是否会影响代码。
  1089 Error code: %s. 这是由于源文件遭到破坏或编译器代码中出现错误造成的。请与 Adobe, Inc. 联系,以便将错误记录备案。
  1091 Migration issue: %s 这是一个代码迁移警告。在 ActionScript 2.0 中,如果声明方法时使用的是特殊名称(如 onMouseDown),那么当发生特定事件时,Flash 可能会调用该方法;在 ActionScript 3.0 中,必须通过方法来调用 addEventListener(),从而对这一函数进行注册以接收该事件。有关详细信息,请参阅本语言参考中的 addEventListener
  1093 Negative value used where a uint (non-negative) value is expected. 将负值赋给 uint 数据类型将产生极大的正值。 var x:uint = -1; trace(x); // 4294967295.
  1097 Illogical comparison with null. Variables of type %s cannot be null. Boolean、int、uint 和 Number 类型的实例不能为 null。与 Boolean 数据类型比较之前,比较运算符类型将 null 转换为 false;与 Number、int 或 uint 数据类型比较之前,将其转换为 0。
  1099 Illogical comparison with NaN. This statement always evaluates to false. NaN 有独特的数学属性,任何涉及该属性的比较的计算结果都为 false。改用全局 isNaN() 函数检测 NaN 值,如下例所示:
trace(NaN == NaN); // false!
trace(NaN != NaN); // false again!
trace(isNaN(NaN)); // true
  1101 Assignment within conditional. Did you mean == instead of =? = 赋值语句的结果是该 = 语句右侧的值。可以将赋值语句用作条件测试,但不建议这样做。通常,出现 = 是由于计划执行 == 相等测试时的键入错误造成的,如下例所示:
var x:Boolean = false;
var y:Boolean = true;
// it is hard to determine if the line below intentionally sets x's value to y's or if its a typo
if (x = y) { trace("x is assigned y's value of true, making the conditional test evaluate as true."); }
  1103 null used where a %s value was expected. 不能将 null 作为值赋给 Boolean、Number、int 和 uint 变量。赋给 Boolean 变量时,null 值会隐式转换为 false;赋给 int、uint 或 Number 变量时,会转换为 0
  1105 No constructor function was specified for class %s. 不指定构造函数是一种个人编码风格偏好。如果希望始终为类声明构造函数,可以启用此警告。 此警告旨在帮助您发现类名称已更改但其构造函数名称没有更改的情况。 此类情况在未启用此警告时不会被标记为问题,前一个构造函数看上去是一个标准函数。
  1111 The constant was not initialized.  
  1113 Array(x) behaves the same as new Array(x). To cast a value to type Array use the expression x as Array instead of Array(x).  
  1115 The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed. 在构造函数内部添加对 super() 的调用是一种个人编码风格偏好。如果希望始终明确 super() 的调用时间,可以启用此警告。当您打算在某些本地初始化代码之后调用 super() 但忘记添加代码时,此警告将非常有用。
  3552 Appending text to a TextField using += is many times slower than using the TextField.appendText() method. 有关此重要文本优化操作的详细信息,请参阅本语言参考中有关 TextField 类的 appendText() 方法的内容。
  3554 Function value used where type %s was expected. Possibly the parentheses () are missing after this function reference. 在 ActionScript 中,可以将函数本身用作值。有问题的代码使用的是 Function 类型的值,但需要的是 Function、Object 或 * 之外的类型。通常,这表示出现了在函数名称之后漏掉括号 () 的键入错误。
  3556 The instanceof operator is deprecated, use the is operator instead.  
  3574 Migration issue: The ActionScript 2.0 XML class has been renamed XMLDocument. 这是一个代码迁移警告。在 ActionScript 3.0 和 ActionScript 2.0 中,XML 是不同的类。ActionScript 3.0 中的 XMLDocument 类与 ActionScript 2.0 中的 XML 类等效。 ActionScript 3.0 XML 类通过更为简便和更加强大的 API 提供了增强的功能。有关其它详细信息,请参阅《ActionScript 语言参考》中的 XML。
  3576 Date(x) behaves the same as new Date().toString(). To cast a value to type Date use "x as Date" instead of Date(x).  
  3582 Importing a package by the same name as the current class will hide that class identifier in this scope.  
  3584 More than one argument named '%s' specified. References to that argument will always resolve to the last one.  
  3590 Non-Boolean value used where a Boolean value was expected.  
  3591 %s used where a Boolean value was expected. The expression will be type coerced to Boolean.  
  3593 %s is not a recognized property of the dynamic class %s. 在严谨的编译模式下,不会在动态类的实例中检查未定义属性。类型 Date、RegExp 和 Error 是动态的,以便实现与 ECMAScript 的向后兼容。此警告可发现在这些类的实例中使用了未定义的属性。一个常见的问题是尝试获取或设置的 Date 值的 year 属性不存在。正确的属性名称是 fullYear
  3595 %s is not a recognized method of the dynamic class %s. 在严谨的编译模式下,不会在动态类的实例中检查未定义方法。类型 Date、RegExp 和 Error 是动态的,以便实现与 ECMAScript 的向后兼容。此警告可发现在这些类的实例中使用了未定义的方法。
  3597 Duplicate variable definition. 编译器检测到变量的重复定义。这会导致意外的结果。ActionScript 不支持变量的块级别作用范围。在函数体内定义的所有变量属于同一范围,即便这些变量在 if 语句、while 语句和 for 语句中定义,也是如此。例如,以下代码就重新声明了变量 x 两次:

function test() {
var x:Number = 10;
if (true) {
for (var x=0; x < 5; x++) // warning here, this is the second defintion of x
trace(x);
}
trace(x); // 5, not 10. The last value set by the for loop above is the current value of x
}
  3598 Definition name is the same as an imported package name. Unqualified references to that name will resolve to the package and not the definition.  
  3599 Definition name is the same as an imported package name. Unqualified references to that name will resolve to the package and not the definition. 如果某项定义的名称与范围内的包相同,则对该名称的任何非限定引用都将解析为该包,而不是解析为该项定义。这会在尝试引用该变量时导致意外的错误。为此,需要限定对该定义的所有引用,以便将其解析为该定义,而不是解析为该包。
  3600 Possible attempt to delete a fixed property.  
  3601 The declared property %s cannot be deleted. To free associated memory, set its value to null. Delete removes dynamically defined properties from an object. Declared properties of a class can not be deleted, the operation merely fails silently. To free memory associated with this variable, set its value to null instead.
  3602 Use of deprecated definition.  
  3603 '%s' has been deprecated. This definition is deprecated and may be removed in the future.
  3604 Use of deprecated definition.  
  3605 %s  
  3606 Use of deprecated definition.  
  3607 '%s' has been deprecated. Please use '%s'.  
  3608 Use of deprecated definition.  
  3609 '%s' has been deprecated since %s. Please use '%s'.  
  3610 Use of deprecated definition.  
  3611 '%s' has been deprecated since %s.  
Flex | 阅读 917 次
文章评论,共0条
游客请输入验证码
浏览568986次