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
相关文档:
以下介绍几种最为常见和实用的FLEX与现有开发语言通信的方法:
1.C#
2.PHP
3.JAVA
1.Flex与C#通信(.net开发中常用)
Flex端代码:
public static function SendMessage(objXML:XML,objResultHandle:Function):void
{
var objHttpService:HTT ......
假设父窗口是p,子窗口是c,子窗口进行操作后返回父窗口
父窗口:
var flag:Boolean = false;
var c:pop = pop(PopUpManager.createPopUp(this,pop,false)); // 新建子窗体对象
c.callFunction = this.fresh; // 子窗体中可以调用的父窗体函数(这里是子窗体关闭时,用来刷新父窗体的内容
function fresh():void
  ......
1.复制内容到系统剪贴板
System.setClipboard(strContent);
2.复制一个ArrayCollection
//dummy solution( well, it works )
var bar:ArrayCollection = new ArrayCollection();
for each ( var i:Object in ac ){
bar.a ......
因为flex builder 工具是基于eclipse 上的,所以一些开发plug in 在flex builder 也是可以用的.
php:
Help-->Software Updates-->Find and Install-->Search for new feature to install-->new Reomote site
URL: http://update.phpeclipse.net/update/st ......