AS3.0 实例学习 熟悉AS3的package,以及多个package之间的相互通信
package todd.interactive{
import flash.display.*;
import flash.events.*;
import todd.interactive.ButtonSet;
public class DisablingButton extends MovieClip {
var labels:Array;
var thisParent:*;
var thisIndex:int;
public function DisablingButton() {
labels = this.currentLabels;
this.addEventListener(MouseEvent.CLICK, disableButton);
this.addEventListener(MouseEvent.ROLL_OVER, over);
this.addEventListener(MouseEvent.ROLL_OUT, out);
this.addEventListener(Event.ADDED,setParent);
}
function disableButton(event:MouseEvent):void {
for (var i:int = 0; i < labels.length; i++) {
if (labels[i].name == "disable") {
this.gotoAndPlay("disable");
}
}
this.removeEventListener(MouseEvent.CLICK, disableButton);
this.removeEventListener(MouseEvent.ROLL_OVER, over);
this.removeEventListener(MouseEvent.ROLL_OUT, out);
enableOthers();
}
function enableButton():void {
this.addEventListener(MouseEvent.CLICK, disableButton);
this.addEventListener(MouseEvent.ROLL_OVER, over);
this.addEventListener(MouseEvent.ROLL_OUT, out);
this.gotoAndStop(1);
}
function over(event:MouseEvent):void {
for (var j:int = 0; j < labels.length; j++) {
if (labels[j].name == "over") {
this.gotoAndPlay("over");
}
}
}
function out(event:MouseEvent):void {
for (var k:int = 0; k < labels.length; k++) {
if (labels[k].name == "out") {
this.gotoAndPlay("out");
}
}
}
function setParent(event:Event):void {
if (this.parent is ButtonSet) {
thisParent=this.parent;
for (var w:int=0; w < thisParent.buttons.length; w++) {
if (this == thisParent.buttons[w]) {
thisIndex=w;
}
}
}
}
function enableOthers():void {
for (var z:int=0; z < thisParent.buttons.length; z++) {
if (z != thisIndex) {
thisParent.buttons[z].enableButton();
}
}
}
}
}
- .NET Core系列之MemoryCache 初识
- 007手机一键Root(安机网一键Root) v3.0 官方最新版 一键ROOT您的Android手机
- 12306密码被盗了怎么办?12306密码外泄解决方法
- 12个字的qq网名
- 150M迷你型无线路由器怎么设置?
- 192.168.1.1打不开怎么办?路由器192.168.1.1打不开的原因以及解决办法
- 2011年电子报合订本 电子报 编辑部 中文 PDF版 [84M]
- 2015年1月15日小米新旗舰发布会现场图文直播
- 2016.3.1vivo Xplay5新品发布会现场视频直播 优酷直播
- 2016华为P9发布会视频直播地址 4月15日华为P9国行发布会直播