as\flex 中添加事件addEventListener()时传递参数
/**
* @author:ycccc8202
* @用途:注册事件进行传递参数的代理类
* @date:2007.8.26
* @example:
* import com.ycccc.utils.JEventDelegate
stage.addEventListener(MouseEvent.MOUSE_DOWN,JEventDelegate.create(mouseDownHandler,"a","b"));
function mouseDownHandler(e:MouseEvent,...arg) {
trace(e)
trace(arg)
}
*/
package com.projectstateview.comm.method
{
import flash.events.Event;
public class JEventDelegate
{
public function JEventDelegate()
{
}
public static function create(f:Function,... arg):Function
{
return function(e:Event):void
{
f.apply(null,[e].concat(arg));
}
}
public static function toString():String
{
return "Class JEventDelegate";
}
}
}
相关文档:
<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate the DateTimeAxis class. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import mx.collections.ArrayCollection;
......
问题描述:
输入一个数,然后按某个运算符,再输入另一个数,按等号即可得出结果。只按照输入顺序计算结果,而非按照运算符优先级来得出结果,即,如果按顺序输入2+8*3=会得到30,而非26.
算法描述:
定义三个全局变量,分别是first(Number), second(Number), symbol(String)
first代表二目运算中第一个数,se ......
flex3 中的中文字体只支持有限的几种,要么嵌入字体,要么就使用这几种:
支持一些默认的英文字体,如Arial、Times New Roman、Courier New、Georgia、Verdana等。
支持的中文字体:宋体、华文楷体、华文细黑、华文仿宋、华文中宋。
Flex3 中即使客户端装了很多字体,能使用的也只能是上面几种字体,除非嵌入字体。
但是 ......
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/09/04/adding-animations-and-effects-to-flex-tool-tips/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertic ......
Flex应用开发过程中如需要灵活的在不同组件(如A与B,父与子)之间响应事件,传递参数等功能时就会使用自定义事件(Event)机制,下面通过一个事例分七步,通过自定义Event和EventDispatcher两种机制实现事件交互和参数传递;
事例描述: 有一个父亲“parentApp.mxml&rd ......