如何在actionScript中动态更改状态单击事件

时间:2011-08-30 08:17:00

标签: flex actionscript-3 events flex4 state

<s:Button id="btnNext" label="Next" width="80"
  click.Title="changeState('Info');"
  click.Info="changeState('Organ');"
/>

如何在actionScript中动态更改“click.Title”事件?

btnNext.addEventListener(MouseEvent.CLICK,  ????

1 个答案:

答案 0 :(得分:0)

如下所示:

btnNext.addEventListener(MouseEvent.CLICK, onClick);

private function onClick(event:MouseEvent):void
{
    switch (currentState)
    {
        case "Title":
            changeState("Info");
            break;
        case "Info":
            changeState("Organ");
            break;
    }
}

ActionScript中没有声明性状态支持。