从基础开始深入学Flash AS3教程(6)(译文)
var myButton:SimpleButton = new SimpleButton();
SimpleButton类有4个属性分别代表按钮的四个不同状态:upState,overState,downState和hitAreaState。你可以为每一个状态创建一个新的显示对象,然后将显示对象赋予SimpleButton的各种状态:
myButton.upState = mySprite1;
myButton.overState = mySprite2;
myButton.downState = mySprite3;
myButton.hitAreaState = mySprite4;
When defining arrays in ActionScript 3 using the shorthand array access operator (brackets), you can now have a trailing comma following the last element without causing an error (like in PHP). This makes working with multi-line array definitions a little less error-prone when rearranging elements.
先来看一个例子:
var myList:Array = [
"The",
"quick",
"brown",
"fox",
];
package my.package.path {
class MyClass {
}
}
而在AS2中,应该是下面的样式:
// ActionScript 2:
class my.package.path.MyClass {
}
package com.kirupa.utils {
function StripString(str:String):void {
// ...
}
}
上面的代码应该保存在一个名称为StripString.as的文件中,并放在路径为com/kirupa/utils的文件夹里。