<?xml version="1.0" encoding="utf-8"?>
<mx:Application name="Button_willTrigger_buttonDown_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.utils.StringUtil;
private function verify_click():void {
var listener:Boolean = btn.hasEventListener(FlexEvent.BUTTON_DOWN);
var trigger:Boolean = btn.willTrigger(FlexEvent.BUTTON_DOWN);
var str:String = "hasEventListener() = {0}{1}willTrigger() = {2}";
Alert.show(StringUtil.substitute(str, listener, "n", trigger));
}
private function addEventListener_click():void {
btn.addEventListener(FlexEvent.BUTTON_DOWN, btn_buttonDown);
verify_click();
}
private function removeEventListener_click():void {
btn.removeEventListener(FlexEvent.BUTTON_DOWN, btn_buttonDown);
verify_click();
}
private function btn_buttonDown(evt:FlexEvent):void {
Alert.show(evt.type);
}
]]>
</mx:Script>
<mx:ApplicationControlBar dock="true">
<mx:Button label="Verify listeners"
click="verify_click();" />
<mx:Spacer width="100%" />
<mx:Button label="addEventListener()"
click="addEventListener_click();" />
<mx:Button label="removeEventListener()"
click="removeEventListener_click();" />
</mx:ApplicationControlBar>
<mx:Button id="btn" label="Button" />
</mx:Application>
分享到:
相关推荐
如键盘事件KeyEvent对应的接口是: public interface KeyListener extends EventListener { public void keyPressed(KeyEvent ev); public void keyReleased(KeyEvent ev); public void keyTyped(KeyEvent ev); } 这...
如何使用 Introduct the js file,then you can use add or remove to add or remove listener!演示结果在每个浏览器中都是 1,2,3! var a = document.getElementById('a');add(a,'click',function(){alert(1)...
React的Socket事件 安装 yarn add react-socket-event ... //remove listener on unmount the component } , [ ] ) ; SocketEvent . emit ( 'my-event' , 'hello, world' ) ; SocketEvent . clear ( 'my-
protected EMEventListener eventListener = null; /** * contact list in cache */ private Map, User> contactList; /** * robot list in cache */ private Map, RobotUser> robotList; private ...
//并将name和ip用":"分开,在服务器端将用一个 //StringTokenizer类来读取数据 String userinfo = nameTextField.getText() + Constants.SEPERATOR + InetAddress.getLocalHost()....
您可以通过on和off方法正常使用它: // Add a clickout listener$ ( 'button' ) . on ( 'clickout' , function ( e ) { console . log ( 'click outside button' )} )// Remove a clickout listener$ ( 'button' ) ...
this.RemoveSession(i); } //on d閏lenche l'関鑞ement Stopped if(this.Stopped!=null) { Stopped(this,EventArgs.Empty); } } } catch{} } /// /// ...
Advanced Event Handling with DOM Level 2 Section 19.3. The Internet Explorer Event Model Section 19.4. The Netscape 4 Event Model Chapter 20. Compatibility Techniques Section 20.1. Platform...
* Position of the last motion event. */ private float mLastMotionX; private float mLastMotionY; /** * ID of the active pointer. This is used to retain consistency during * drags/flings if ...
// drag source listener } public void dragDropEnd(DragSourceDropEvent e) { ghostImage = null; sourceNode = null; } public void dragEnter(DragSourceDragEvent e) { } public void dragExit...
《C#全能速查宝典》共分为8章,分别介绍了C#语言基础、Windows窗体及常用控件、Windows高级控件、控件公共属性、方法及事件、数据库开发、文件、数据流与注册表、GDI+绘图技术和C#高级编程,共包含562个C#编程中常用...
The default behavior of this method is to call addCookie(Cookie cookie) on the wrapped response object. addCookie(Cookie) - Method in interface javax.servlet.http.HttpServletResponse Adds the ...
Table of Contents Introduction....................................................................................................13 Code Examples.........................................................