/**
* @class:DrawPieGraph(画饼状图)
* @author:ycccc8202
* @date:2007.8.16
* @example:
* import com.ycccc.Graphics.*;
* var dataList:Array=[10,10,10,100,10,10,10,100];
* var pie:DrawPieGraph=new DrawPieGraph(200,200,150,90,15,dataList,[0xFF0F00,0xFF6600,0xFF9E01,0xFCD202,0xF8FF01,0xB0DE09,0x04D215,0x0D8ECF]);
* addChild(sprite);
*/
package com.ycccc.Graphics{
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.Shape;
import flash.display.Graphics;
import flash.events.MouseEvent;
public class DrawPieGraph extends MovieClip {
//存放shape对象
private var __contain:Object;
//设置角度从-90开始
private var R:int=-90;
private var D:uint=30;
private var _shape:Shape;
//初始饼图的圆心位置
private var _x0:Number;
private var _y0:Number;
//椭圆饼图的长轴与短轴长度
private var _a:Number;
private var _b:Number;
//饼图的厚度
pri
- 2007/08/14 | AS3中类似watch的功能(附类文件)
-
类别(flash学习)
|
评论(0)
|
阅读(590)
|
发表于 11:34
-
AS2 中我们能够直接用watch对一些对象属性的更改进行监测,但是一些实例原有的方法却无法监测,比如mc._x没法用watch来监测
AS3 中提供了Proxy代理类,这样我们能够对对象的原有属性以及自定义属性进行类似AS2中watch的监测.
/**
*
* @class:WO(.watch)
* @author:ycccc8202
* @date:2007.8.2
* @example:
* import com.ycccc.utils.WO;
* var mc:MovieClip=new MovieClip();
* var __mc:WO=new WO(mc);
* var arg:String="1234";
* __mc.watch("x",watchFunc);
* function watchFunc(p,o,n,a) {
* trace(arguments);
* return n;
* }
* __mc.x=99;
* __mc.x=100;
* __mc.watch("y",watchFunc,arg);
* __mc.y=101;
* __mc.y=102;
*
**/
package com.ycccc.utils{
import flash.utils.Proxy;
import flash.utils.flash_proxy;
public dynamic class WO extends Proxy {;
private var _obj:*;
private var _watchHashTable:Object;
/**Constructor WO
*
* @param obj:* 对象
*
**/
public function WO(obj:*) {
_watchHashTable={};
_obj=obj;
}
/**Public function watch
*
* @param prop:String 属性
* @param callBackFunc:Function 回调函数
* @param arg:*=null 可选参数
*
**/
p