关于Flex中自定义事件的创建步骤,在Adobe一周视频上是这样讲述的:
1. Define the event with the event metadata tag.
2. Instantiate the event.
3. Dispatch the event.
4. Create an event handler.
5. Use the information/data in the event object.
步骤详解:
For 1: 在metadata标记中定义event
<mx:Metadata>
[Event(name="eventName", type="flash.events.Event")]
</mxMetadata>
For 2/3: 首先在控件中,如按钮等的系统事件中调用yourHandler,例如click="yourHandler"。其中yourHandler是你自己定义的方法,如下:
private functionyourHandler(event:Event):void{
var eventObj:Event = new Event("eventName");
dispatchEvent(eventObj);
}
For 4/5: 最后定义自定义时间的Handler,并在这个Handler中定义你需要做的业务功能。
private functioneventNameHandler(event:Event):void{
//your bussiness logic here.
}
最后在被触发的控件上就可以使用eventName="eventNameHandler(event)"了。
分享到:
相关推荐
Pro.NET2.0 Windows Forms and Custom Controls in C# (Dec 2005)英文版
Pro.NET2.0 Windows Forms and Custom Controls in C# (Dec 2005)的源码
Pro .NET 2.0 Windows Forms and Custom Controls in C# 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络...
Pro .NET 2.0 Windows Forms And Custom Controls In VB 2005.pdf 精通VB2005编程DotNet2.0窗口表单和用户控制界面
Pro .NET 2.0 Windows Forms And Custom Controls In VB 2005.pdf 精通VB2005编程DotNet2.0窗口表单和用户控制界面
Pro .NET 2.0 Windows Forms And Custom Controls In VB 2005.pdf 精通VB2005编程DotNet2.0窗口表单和用户控制界面
Pro .NET 2.0 Windows Forms And Custom Controls In VB 2005.pdf 精通VB2005编程DotNet2.0窗口表单和用户控制界面
Flex 4 in a day About this document Introduction MXML 2009 Namespaces States New MXML Tags Declarations Library Definition Private Reparent DesignLayer Two-way data binding MXML Graphics...
Custom Security in ASP.NET
是原汁源味的E文。。。 Contents: <br>Chapter 1: Learning Flex Builder Chapter 2: About Flex Builder ...Flex Builder User Interface Reference Chapter 16: Creating Custom MXML Components
CCBPropertySheet Custom Font in Property Sheets 修改CPropertySheet字体 可以解决win8字体问题
Pro .NET 2.0 Windows Forms and Custom Controls in C# Apress+-+Pro+.NET+2.0+Windows+Forms+and+Custom+Controls+in+C#+(SourceCode)
fix changing text issue in the SelectedValueChange event
总共有4个例子: 1.http://127.0.0.1:8080/flexDemo/HelloWorld/HelloWorld.html ...如果你的数据库配置和我的不一样,请修改flexDemo\WEB-INF\classes\下的DBSetting.properties文件,数据库建表的sql语句是user.sql
《精通.NET 2.0 C# Windows窗体和自定义控件》 英文版PDF 文件太大,源码分开发布
SAP Fiori - Adding a Custom Workflow in 6 Steps
Flex 4 对自定义类的数据绑定,附件是一个mxml文件和自定义类的as文件。
CustomEvent构造函数Polyfill 为IE9 +填充CustomEvent构造函数。 ES6模块化。 用法: import CustomEventPolyfill from './path/to/custom-event-polyfill.js';
+ Added Custom columns - you can extract information from description and display it in event list. + Added alerts by event type. * NewAPI: Event description could be missing for some events. Fixed. *...
Apress - Pro .NET 2.0 Windows Forms and Custom Controls in VB 2005 用户控件