Flex 学习笔迹之1 flex的事件(1)
Adobe Flex 3 Help > Flex Programming Elements > Using Events
Adobe Flex 3 Help
Flex Programming Elements / Using Events
Using events
Using events in Flex is a two-step process. First, you write a function or class method, known as an event listener or event handler, that responds to events. The function often accesses the properties of the Event object or some other settings of the application state. The signature of this function usually includes an argument that specifies the event type being passed in.
The following example shows a simple event listener function that reports when a control triggers the event that it is listening for:
<?xml version="1.0"?>
<!-- events/SimpleEventHandler.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp();">
<mx:Script><![CDATA[
import mx.controls.Alert;
private function initApp():void {
b1.addEventListener(MouseEvent.CLICK, myEventHandler);
}
private function myEventHandler(event:Event):void {
Alert.show("An event occurred.");
}
]]></mx:Script>
<mx:Button id="b1" label="Click Me"/>
</mx:Application>
As you can see in this example, you also register that function or class method with a display list object by using the addEventListener() method.
Most Flex controls simplify listener registration by letting you specify the listener inside the MXML tag. For example, instead of using the addEventListener() method to specify a listener function for the Button control's click event, you specify it in the click attribute of the <mx:Button> tag:
<?xml version="1.0"?>
<!-- events/SimplerEventHandler.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script><![CDATA[
import mx.controls.Alert;
private function myEventHandler(event:Event):void {
Alert.s
相关文档:
假设父窗口是p,子窗口是c,子窗口进行操作后返回父窗口
父窗口:
var flag:Boolean = false;
var c:pop = pop(PopUpManager.createPopUp(this,pop,false)); // 新建子窗体对象
c.callFunction = this.fresh; // 子窗体中可以调用的父窗体函数(这里是子窗体关闭时,用来刷新父窗体的内容
function fresh():void
  ......
学flex就是为了跳槽,万恶的公司,年底什么都没有,害的我都没钱回家,杯具啊。
学flex已经有一段时间了,我是java程序员,欢迎大家交流
最近学了点cairngorm 感觉用起来比struts繁琐一点,废话少说,上代码:
1.先看vo,本实例是一个添加联系人的小例子,名字,邮箱,添加时间三个属性,都是搞 java的,刘若 ......
package event
{
import flash.events.Event;
public class CustomEvent extends Event
{
public var evObject:Object;
public function CustomEvent( ......