Actionscript 3 禁用AS3问题中的按钮
我想在flash中动态创建一个简单的选项卡菜单,我只希望在开始使用我的应用程序时启用第一个选项卡,其他选项卡将在以后启用。但是,导出电影后,选项卡不可单击(光标不显示为手),但当我单击其中一个选项卡时,其代码将启动。问题出在哪里? 这是我的代码(到目前为止,我只有两个选项卡): 这是Tab类:Actionscript 3 禁用AS3问题中的按钮,actionscript-3,button,Actionscript 3,Button,我想在flash中动态创建一个简单的选项卡菜单,我只希望在开始使用我的应用程序时启用第一个选项卡,其他选项卡将在以后启用。但是,导出电影后,选项卡不可单击(光标不显示为手),但当我单击其中一个选项卡时,其代码将启动。问题出在哪里? 这是我的代码(到目前为止,我只有两个选项卡): 这是Tab类: package coa.application{ import flash.display.SimpleButton; import flash.text.*; public c
package coa.application{
import flash.display.SimpleButton;
import flash.text.*;
public class Tab extends SimpleButton {
public var menuType:String;
public function Tab(tabText:String, menuType:String, x:Number, y:Number) {
this.menuType=menuType;
var mytext:TextField=new TextField();
var fm:TextFormat = new TextFormat("Verdana", 18);
mytext.autoSize = TextFieldAutoSize.CENTER;
mytext.text=tabText;
mytext.border = true;
mytext.selectable = false;
mytext.background = true;
mytext.setTextFormat(fm);
upState = overState = downState = hitTestState = mytext;
this.x=x;
this.y=y;
}
}
}
我认为没有“启用”属性。你有没有试过把鼠标设为false。甚至更好。在选项卡类上设置一个已启用属性,然后在showMenu中选中该属性。如果选项卡未启用,则可以忽略单击
package coa.application{
import flash.display.SimpleButton;
import flash.text.*;
public class Tab extends SimpleButton {
public var menuType:String;
public function Tab(tabText:String, menuType:String, x:Number, y:Number) {
this.menuType=menuType;
var mytext:TextField=new TextField();
var fm:TextFormat = new TextFormat("Verdana", 18);
mytext.autoSize = TextFieldAutoSize.CENTER;
mytext.text=tabText;
mytext.border = true;
mytext.selectable = false;
mytext.background = true;
mytext.setTextFormat(fm);
upState = overState = downState = hitTestState = mytext;
this.x=x;
this.y=y;
}
}
}