• 【设为首页】
  • 【收藏闪客居】
当前位置:主页>FLASH AS 编程>AS基础篇>AS 3.0>文章内容
  • FLASH AS3.0 SimpleButton实例
  • 来源: 作者: 2007-11-03 【

SimpleButton实例

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

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

CODE:
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.

先来看一个例子:

CODE:
var myList:Array = [
    "The",
    "quick",
    "brown",
    "fox",
];
在AS1和2中,"fox"后的逗号会导致一个编译错误,但是在AS3中不会了。

注意,这个逗号只是在使用[]定义数组的时候有效,使用Array()或new Array()的时候是无效的。




上一篇:FLASH AS3.0 包块   下一篇:FLASH AS3.0 标签申明
  • 用户名:新注册) 密码: 匿名评论
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规)

Copyright © 2006-2008 flashas.net All Rights Reserved.
网站内容咨询: admin#flashas.net (#为@) 联系QQ:40777822 浙ICP备06033001号
(本网站最佳浏览解析度为1024*768, 建议使用IE 6.0或以上版本浏览器。)