0

在 flex 应用程序中,我在动作脚本中有一个按钮和两个函数...当我单击按钮时,它必须调用一个函数并中止并同时调用另一个函数....我希望你们抓住了我想要的 wat传达...thanxx :-)

4

1 回答 1

0

请参阅样本

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
    creationComplete="{appCreationComplete()}"
    >
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;

            private function appCreationComplete():void
            {
                btn.addEventListener(MouseEvent.CLICK,clickHandlerA);
                btn.addEventListener(MouseEvent.CLICK,clickHandlerB);

            }

            private function clickHandlerA(event:MouseEvent):void
            {
                Alert.show("clickHandlerA");
            }

            private function clickHandlerB(event:MouseEvent):void
            {
                Alert.show("clickHandlerB");
            }

        ]]>
    </mx:Script>
    <mx:Button id="btn" label="Click me"/>
</mx:Application>

在此示例 On Applocation CreationComplete中,我们将两个事件处理程序绑定 到按钮

希望有帮助

于 2011-04-22T07:54:31.547 回答