我创造了两个组合框。我必须创建一个匹配以下程序,以便
function changeHandler(e:Event)
{
trace(ComboBox(e.target).selectedItem.label+ComboBox(a1).selectedItem.label);
}
如果e.target检索a1
。我必须将其拆分为1
答案 0 :(得分:0)
这确实有效
假设您的ComboBox实例名称为a0
import fl.controls.ComboBox;
a0.addEventListener(Event.CHANGE, changeHandler);
function changeHandler(e:Event) {
trace(e.target.selectedItem.label);
trace(e.target.selectedItem.label.substring(1));
}
答案 1 :(得分:0)
对于一般字符串"a1"
:
function changeHandler(e:Event)
{
var tempStr:String = "a1";
var intValue:int = int(tempStr.substr(1));
}
适用于ComboBox(e.target).selectedItem.label
:
function changeHandler(e:Event)
{
var tempStr:String = ComboBox(e.target).selectedItem.label;
var intValue:int = int(tempStr.substr(1));
}
答案 2 :(得分:-2)
这里没有Flash,但我想你可以试试
trace(ComboBox(e.target).selectedItem.label+substring(1,ComboBox(a1).selectedItem.label));
有效吗?