flex event实例
EventArgExtend.as
package myeventhelper
{
public class EventArgExtend
{
public function EventArgExtend()
{
}
public static function create(f:Function,...arg):Function //addEventListener注册事件进行传递参数的方法
{ //EventArgExtend.create(comB.onGetParentTotal,this)
var F:Boolean = false; //让参数进行并且只一次合并
var _f:Function = function(e:*,..._arg)
{
_arg = arg;
if(!F)
{
F = true;
_arg.unshift(e); //向数组的开始部位加入
}
f.apply(null,_arg); //把参数都放到一个数组里,再传进去;
}
return _f;
}
public static function toString():String
{
return "Class JEventDelegate";
}
}
}
MyEventDispatcher.as 自定义事件发送者类
package myeventhelper
{
import flash.events.EventDispatcher;
import mx.core.UIComponent;
//自定义事件触发类
public class MyEventDispatcher extends EventDispatcher
{
private static var _instance:MyEventDispatcher;
public static const EXEC_PARENT_METHOD:String="ExecParentMethod"; //执行Parent方法
public static function getInstance():MyEventDispatcher
{
if(_instance==null){
_instance=new MyEventDispatcher();
}
return _instance;
}
public var Source:UIComponent; //事件源对象
public var Parsms:Object; //主要用于参数传递
}
}
MyExtendEvent.as 自定义event扩展类
package myeventhelper
{
import mx.events.FlexEvent;
//用户自定义事件类
public class MyExtendEvent extends FlexEvent
{
public static const EXEC_BROTHER_METHOD:String="ExecBrotherMethod";//执行兄弟方法
publ
相关文档:
有好用的东西一定要共享。
PaginationDataGrid.mxml文件分页组件
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
<mx:Script source="../../../common/utils/Commo ......
用的是Commons上传组件,下载地址:Commons
网上找的小例子改的,修改了部分错误。
1,FileUpload.java
package com.fileupload;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.List;
import ja ......
今天用Flex语言写了个检查非法字符,和数字的方法,共大家交流
稍微改一下就能用到.NET或Java语言中
public class CheckString
{
//判断用户是否输入非法字符
public static function CheckStr(strValue:String):Boolean
{
......
Flex 4带给我们的,是全新的命名空间。了解这些命名空间必定是一件好事情。Flex 4有三个非常重要的命名空间,分别是:
xmlns:fx=”http://ns.adobe.com/mxml/2009″
xmlns:mx=”library://ns.adobe.com/flex/halo”
xmlns:s=”library://ns.adobe.com/flex/spark&rdq ......