易截截图软件、单文件、免安装、纯绿色、仅160KB

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 {as总结}

  作为一个不入流的flex开发人员总结一下不入流的感悟。
  我一定要记住,as中的变量的作用范围只有两种,function和class,所以要想用闭包就需要一个createFunction的东西才行,不要妄想在for循环中用闭包了。看了一下as3的参考,发现它的前世和lua还真像,as3的继承其实还是prototype来做的,就是lua的元表了, ......

9本经典Flex As电子书


ActionScript 3.0 语言和组件参考

Foundation ActionoScript3.0 动画

Learning Flex3

AS3 Cheat Sheets

Flex Frameword Diagram

Rich Internet Applications With Adobe Flex & Java
......

flex 日记1 cairngorm

学flex就是为了跳槽,万恶的公司,年底什么都没有,害的我都没钱回家,杯具啊。
学flex已经有一段时间了,我是java程序员,欢迎大家交流
最近学了点cairngorm   感觉用起来比struts繁琐一点,废话少说,上代码:
1.先看vo,本实例是一个添加联系人的小例子,名字,邮箱,添加时间三个属性,都是搞 java的,刘若 ......

FABridge教程(Flex+Ajax)

一.通过js访问Flex组件
    1.准备工作。先建立Flex工程 :fademo,并放置一个文本框:txtName。做完后代码应该类似于这个样子:
view plaincopy to clipboardprint?
·········10······· ......

FABridge教程(Flex+Ajax) 2

首先在fademo.mxml中声明一个button,并添加一个btnClick方法:
view plaincopy to clipboardprint?
<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"   
             ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号