1、新建一个“shijian”影片剪辑
2、在“shijian”影片剪辑第一帧创建一个动态文本框,变量为“mytime” 3、在“shijian”影片剪辑新建一帧,打开动作面板写入下面代码: function showtime(){ var time=new Date() //得到系统时间字符串 mytime=substring(time,11,9) //只截取其中时分秒的部分 } setInterval(showtime,100); //100毫秒刷新一次 4、把“shijian”影片剪辑放到主场景中,ctrl+enter测试。 (二)获取系统日期 1、新建一个“riqi”影片剪辑 2、在“riqi”影片剪辑第一帧创建一个动态文本框,变量为“myriqi” 3、在“riqi”影片剪辑新建一帧,打开动作面板写入下面代码: 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测试。 |
|