谁知道用Flex做一个秒计时呢?

来源:百度知道 编辑:UC知道 时间:2024/06/02 09:09:09
我点击一个按钮事件,开始计时,计时显示在一个Label里面。
计时的时候是从1开始显示。

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="init()" >

<mx:Script>
<![CDATA[
[Bindable]
public var strTime:Number = 0;

public var timer:Timer;
/**
* 页面初始化
*/
public function init():void{
timer = new Timer(1000, 60)//1000是指1秒走一次 60是走60秒,可以自己根据需求设定
}

/**
* 启动一个线程 添加一个事件监听
*/
public function btnClick():void{
timer.addEventListener(TimerEvent.TIMER, funTimer);
timer.start();
}

/**