在flash中让一个动态文本框显示系统当前时间

要不断刷新的,不要MC,谁给出代码,对了的话,追加一百... 要不断刷新的,不要MC,谁给出代码,对了的话,追加一百 展开
 我来答
匿名用户
2009-09-01
展开全部
var today:Date;
var todayYear:Number;
var todayMonth:Number;
var todayDay:Number;
var todayWeek:String;
var nowHour:Number;
var nowMinute:Number;
var nowSecond:Number;
var weekArray:Array;
var dayShow:String;
var monthShow:String;
var hourShow:String;
var minuteShow:String;
var secondShow:String;
var timer:Timer;
timer=new Timer(100);
timer.addEventListener(TimerEvent.TIMER,deal);
timer.start();
function timeInit()
{
weekArray=new Array("日","一","二","三","四","五","六");
today=new Date();
todayYear=today.getFullYear();
todayMonth=today.getMonth();
todayDay=today.getDate();
todayWeek=weekArray[new int(today.getDay())];
nowHour=today.getHours();
nowMinute=today.getMinutes();
nowSecond=today.getSeconds();
}
function deal(evt:Event)
{
timeInit();
dealWith(todayMonth,todayDay,nowHour,nowMinute,nowSecond);
//timeShow这是一个舞台里面的对态文本对象,实例名叫timeShow用来显示日期与时间的
timeShow.text="现在是"+todayYear+"年"+monthShow+"月"+dayShow+"日 "+hourShow+":"+minuteShow+":"+secondShow+" 星期"+todayWeek;
}
function dealWith(paraMonth,paraDay,paraHour,paraMinute,paraSecond)
{
if (paraMonth<10)
{
monthShow="0"+(todayMonth+1);
} else
{
monthShow=(todayMonth+1).toString();
}
if (paraDay<10)
{
dayShow="0"+todayDay;
} else
{
dayShow=todayDay.toString();
}
if (paraHour<10)
{
hourShow="0"+nowHour;
} else
{
hourShow=nowHour.toString();
}
if (paraMinute<10)
{
minuteShow="0"+nowMinute;
} else
{
minuteShow=nowMinute.toString();
}
if (paraSecond<10)
{
secondShow="0"+nowSecond;
} else
{
secondShow=nowSecond.toString();
}
}

http://up.qzone.net.cn/flash9/20090901071257_time.swf
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式