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
相关文档:
声明:自己想的、写的东西,转载请注明出处; 不要向我要代码; from CSDN ID: wander000
目的:在做小程序时,显示一些重要的数据如帐号密码等,不想让别人直接看到,在指定组件上按规定好的轨迹晃动鼠标才显示。
问题:一、直接打开数据库不就看到明码了?二、怎么判断鼠标轨迹的形状?
解决:一、数据库存取时用上加 ......
由于avm版本的问题,flex3无法直接调用flash做的swf文件,弄了一天,最后终于想到了一个办法,将LocalConnect和flex调用as3两种方式攒在了一起,算是暂时把这个问题解决了!
存起来,留着以后修改
第一步:用flash做一个as2的文件
我在里面添加了一个按钮
在第一帧写下面的代码
mybtn.onRelease=function()
{
......
这几天要学一下flex开发,但是安装的是eclipse插件版的,可是安装好后发现没有可视化的编辑视图,最后发现其实是因为flex的mxml文件的打开方式是使用的spket编辑器打开的,所以没有可视化编辑视图,于是吧spket卸载了。就好了。记录一下,希望能帮到别人,也让自己记住 ......
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 ......
php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charse ......