flex 实时内存使用率图
<?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 the total memory Flash Player is using.
o.memory=flash.system.System.totalMemory;
// Add new object to the ArrayCollection, which
// is bound to the chart's data provider.
memoryUsage.addItem(o);
}
]]-->
</mx:Script>
<mx:LineChart id="chart"
dataProvider="{memoryUsage}"
showDataTips="true">
<mx:horizontalAxis>
<mx:LinearAxis/>
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis minimum="5000000"/>
</mx:verticalAxis>
<mx:series>
<mx:Array>
<mx:LineSeries yField="memory"/>
</mx:Array>
</mx:series>
</mx:LineChart>
</mx:Application>
相关文档:
其实一般的情况下是不会用到这种情况的,一般在程序里,比如选中要填写的项目,都喜欢有一个选中的状态,但是现在我们来个反其道而行,如果我不想要这个状态该怎么办呢?
参考了些资料,其实也简单,有好几种方法,但是发现了一个最有用的方法,首先我们在舞台上随意放几个TEXTINPUT ......
问题描述:
输入一个数,然后按某个运算符,再输入另一个数,按等号即可得出结果。只按照输入顺序计算结果,而非按照运算符优先级来得出结果,即,如果按顺序输入2+8*3=会得到30,而非26.
算法描述:
定义三个全局变量,分别是first(Number), second(Number), symbol(String)
first代表二目运算中第一个数,se ......
看了很多Flex的书,关于Flex的生命周期自认为了解的还不错,但是突然上网上看到一个哥们用图表把Flex 的Application启动过程以及自定义组件的生命周期表达的非常清晰,很是佩服,特分享出来,内容如下:
Flex Custom Component LifeCycle
由 jexchan
撰写
http://blog.ityao.com/archives/169
......
. 匹配除换行符"\n"外的任意单个字符。
[] 匹配括号中字符的任意一个。用"-"指示字符的范围。如果第一个字符是抑扬符号"^",那么它的含义变为匹配括号内字符以外援任意字符。
* 匹配前面正则表达式的零次或多次出现。
+ 匹配前面正则表达式的一次或多次出现。
? 匹配前面正则表达 ......