每天学点AS3-7

每天学点AS3-7

14,SimpleButton实例

AS3现在有一个新的类:SimpleButton(flash.display.SimpleButton)。这个类允许你通过AS创建一个按钮。

 
 

var myButton:SimpleButton = new SimpleButton();
SimpleButton类有4个属性分别代表按钮的四个不同状态:upState,overState,downState和hitAreaState。你可以为每一个状态创建一个新的显示对象,然后将显示对象赋予SimpleButton的各种状态:

myButton.upState = mySprite1;
myButton.overState = mySprite2;
myButton.downState = mySprite3;
myButton.hitAreaState = mySprite4;
15,数组定义中的逗号

本文非直接翻译,原文解释部分如下:
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",
];
在AS1和2中,"fox"后的逗号会导致一个编译错误,但是在AS3中不会了。

注意,这个逗号只是在使用[]定义数组的时候有效,使用Array()或new Array()的时候是无效的。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值