/**
* @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"?>
<!-- charts/MemoryGraph.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
initialize="initTimer()">
<mx:Script>
<!--[CDATA[
import flash.utils.Timer;
import flash.events.TimerEvent;
import mx.collections.ArrayCollection;
[Bindable]
public var memoryUsage:ArrayCollection=new ArrayCollection();
public function initTimer():void
{
// The first parameter in the Timer constructor
// is the interval, in milliseconds. The second
// parameter is how many times to run (0 is
// infinity).
var myTimer:Timer=new Timer(1000, 0);
// Add the listener for the timer event.
myTimer.addEventListener("timer", timerHandler);
myTimer.start();
}
public function timerHandler(event:TimerEvent):void
{
var o:Object=new Object();
// Get the number of milliseconds since Flash
// Player started.
o.time=getTimer();
// Get t ......
<?xml version="1.0"?>
<!-- charts/VerticalLineChart.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<!--[CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var expenses:ArrayCollection=new ArrayCollection([{Month: "Jan", Profit: 2000, Expenses: 1100}, {Month: "Feb", Profit: 1800, Expenses: 1055}, {Month: "Mar", Profit: 1200, Expenses: 800}, {Month: "Apr", Profit: 1400, Expenses: 900}, {Month: "May", Profit: 1400, Expenses: 1150}, {Month: "Jun", Profit: 1340, Expenses: 600}, {Month: "Jul", Profit: 1600, Expenses: 950}, {Month: "Aug", Profit: 1500, Expenses: 1140}, {Month: "Sep", Profit: 1800, Expenses: 1200}, {Month: "Oct", Profit: 2000, Expenses: 1280}, {Month: "Nov", Profit: 2400, Expenses: 1300}, {Month: "Dec", Profit: 1500, Expenses: 500}]);
]]-->
......
<?xml version="1.0"?>
<!-- charts/GradientFills.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<!--[CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var expenses:ArrayCollection=new ArrayCollection([{Expense: "Taxes", Amount: 2000}, {Expense: "Rent", Amount: 1000}, {Expense: "Bills", Amount: 100}]);
]]-->
</mx:Script>
<mx:Panel title="Background Fill">
<mx:BarChart id="myChart"
dataProvider="{expenses}"
showDataTips="true">
<mx:verticalAxis>
<mx:CategoryAxis dataProvider="{expenses}"
categoryField="Expense"/>
</mx:verticalAxis>
<mx:fill>
<mx:LinearGradient>
<mx:entries>
<mx:GradientEntry color="0xC5C551"
ratio="0"
......
<?xml version="1.0"?>
<!-- charts/ColumnWithDropShadow.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:flash="flash.filters.*">
<mx:Script>
<!--[CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var expenses:ArrayCollection=new ArrayCollection([{Month: "Jan", Profit: 2000, Expenses: 1500}, {Month: "Feb", Profit: 1000, Expenses: 200}, {Month: "Mar", Profit: 1500, Expenses: 500}]);
]]-->
</mx:Script>
<mx:Panel title="ColumnChart with drop shadow example">
<mx:ColumnChart id="column"
dataProvider="{expenses}"
showDataTips="true">
<!-- Add a custom drop shadow filter to the ColumnChart control. -->
<mx:filters>
<mx:DropShadowFilter distance="10"
color="0x666666"
alpha=".8"/>
......
<?xml version="1.0"?>
<!-- charts/DataPointAlert.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<!--[CDATA[
import mx.controls.Alert;
import mx.charts.events.ChartItemEvent;
import mx.collections.ArrayCollection;
[Bindable]
public var dataSet:ArrayCollection=new ArrayCollection([{Month: "Jan", Expenses: 1500}, {Month: "Feb", Expenses: 200}, {Month: "Mar", Expenses: 500}]);
public function myHandler(e:ChartItemEvent):void
{
Alert.show("Chart data was clicked");
}
]]-->
</mx:Script>
<mx:Panel title="Clickable Column Chart">
<mx:ColumnChart id="myChart"
itemClick="myHandler(event)"
dataProvider="{dataSet}">
<mx:horizontalAxis>
<mx:CategoryAxis dataProvider="{dataSet}"
categoryField="Month"/>
......