ActionScript 3 AS3 ComboBox“onSelect”正在改变

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 AS3 ComboBox“onSelect”正在改变相关的知识,希望对你有一定的参考价值。

// this code assumes the existance of a ComboBox (Components -> User Interface -> ComboBox) 
// on the stage with an instance name of "MY_DROPDOWN_INSTANCE_NAME" plus two items defined in its properties
// named "Choice One" and "Choice Two"

var MY_DROPDOWN_LISTENER:Object=new Object();  // a new listener
MY_DROPDOWN_INSTANCE_NAME.addEventListener("change", MY_DROPDOWN_LISTENER);  //add listener to combobox
MY_DROPDOWN_LISTENER.change=function(){  //function called
    // do something based on the selected item's label
    switch(MY_DROPDOWN_INSTANCE_NAME.getSelectedItem().label) {
        case "Choice One":
            trace("one");
            break;
        case "Choice Two":
            trace("two");
            break;
    }

    // do something based on the selected item's value
    switch(MY_DROPDOWN_INSTANCE_NAME.getSelectedItem().data) {
        case "Choice One":
            trace("one");
            break;
        case "Choice Two":
            trace("two");
            break;
    }
}

以上是关于ActionScript 3 AS3 ComboBox“onSelect”正在改变的主要内容,如果未能解决你的问题,请参考以下文章

[ActionScript 3.0] AS3.0 水面波纹效果

ActionScript 3 AS3:使用SWFObject2和AS3传递变量

ActionScript 3 克隆数组(AS3)

ActionScript 3 AS3序列化

ActionScript 3 As3初始上限

ActionScript 3 AS3 HTML清理