1、新建一个“riqi”影片剪辑
2、在“riqi”影片剪辑第一帧创建一个动态文本框,变量为“myriqi”
3、在“riqi”影片剪辑新建一帧,打开动作面板写入下面代码:
newDate = new Date();
myriqi = newDate.getFullYear() + "年" + (newDate.getMonth() + 1) + "月" + newDate.getDate() + "日";
onEnterFrame = function ()
{
newDate = new Date();
if (newDate.getHours() < 10)
{
xs = "0" + newDate.getHours();
}
else
{
xs = newDate.getHours();
} // end if
if (newDate.getMinutes() < 10)
{
fz = "0" + newDate.getMinutes();
}
else
{
fz = newDate.getMinutes();
} // end if
if (newDate.getSeconds() < 10)
{
ms = "0" + newDate.getSeconds();
}
else
{
ms = newDate.getSeconds();
} // end if
DateTextField = xs + ":" + fz + ":" + ms;
};
4、把“riqi”影片剪辑放到主场景中,ctrl+enter测试。