1个回答
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
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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询