Flex元数据标签之[Event]
Flex中引入了元数据标签的概念,这些标签并没有被编译到SWF文件中,而只是告诉编译器如何生成SWF 文件。 [Event] 使用[Event]标签定义MXML中的事件属性及组件生成的事件对象的类型。[Event]标签插入到ActionScript文件的类定义前,或者MXML文件的<mx:Metadata>块内。 Use the [Event] metadata tag to define the MXML property for an event and the data type of the event object that a component emits. You insert the [Event] metadata tag before the class definition in an ActionScript file,or in the <mx:Metadata> block in an MXML file.? 用法如下: [Event(name="eventName",type="package.eventType")] [Event]标签的属性如下:
用法--下面的例子指定了组件可广播的事件为myClickEvent: [Event(name="myClickEvent",type="flash.events.Event")] If you do not identify an event in the class file with the [Event] metadata tag,the MXML compiler generates an error if you try to use the event name in MXML (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |