易截截图软件、单文件、免安装、纯绿色、仅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调用as2的swf

由于avm版本的问题,flex3无法直接调用flash做的swf文件,弄了一天,最后终于想到了一个办法,将LocalConnect和flex调用as3两种方式攒在了一起,算是暂时把这个问题解决了!
存起来,留着以后修改
第一步:用flash做一个as2的文件
我在里面添加了一个按钮
在第一帧写下面的代码
mybtn.onRelease=function()
 {
......

flex 4插件版安装没有视图模式原因之一

这几天要学一下flex开发,但是安装的是eclipse插件版的,可是安装好后发现没有可视化的编辑视图,最后发现其实是因为flex的mxml文件的打开方式是使用的spket编辑器打开的,所以没有可视化编辑视图,于是吧spket卸载了。就好了。记录一下,希望能帮到别人,也让自己记住 ......

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"   
             ......

[Flex] First Flex AIR App

试用了一下Flex,创建HelloWorld应用的顺序如下:
1 创建文件: HelloWorld-app.xml 
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://ns.adobe.com/air/application/1.5">
    <id>com.kdevn.flex.HelloWorld</id>
    <version&g ......

Flex 用Grid实现类似于Html的细线表格

我们在用Flex进行开发的时候,有时候需要实现像html 细线表格的那种效果,原理很简单,但是需要一些技巧,不然的话很难控制线条的粗细,其实只需要设置几个样式就能搞定,一下是源码,大家可以运行一下看看效果<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号