文章搜索:
打开支付宝首页搜索“510617664”,即可领红包
  首页--> 计算机--> FLASH教程
 
每天学点AS3-7
http://www.xxqqss.com 学习轻松网 点击量:3048
 
*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;
*数组定义中的逗号


本文非直接翻译,原文解释部分如下:
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()的时候是无效的。

打印】 【关闭
免责声明 :本站刊载此文不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。对本文有任何异议,请发送fiyeadwyv@163.com
最热门点击排行
 
版权所有 2006-2021:学习轻松网 Copyright http://www.xxqqss.com All rights reserved 浙ICP备14013707号-1
广告联系电话: 13958357030 联系QQ:9792414 工具条下载