|
 
- 帖子
- 1669
- 积分
- 334
- 技术分
- 88
- 来自
- 重庆渝北
- 在线时间
- 620 小时
- 注册时间
- 2005-4-9
|
10#
发表于 2007-10-4 14:54
| 只看该作者
- function 一位数前补0(tim:Number):String {
- return tim < 10 ? ("0" + tim) : tim;
- }
- function 画圆(mc:MovieClip, k:Number):Void {
- mc.moveTo(Math.cos(0 * Math.PI / 180) * k, Math.sin(0 * Math.PI / 180) * k);
- for (var i = 360; i >= 0; i--) {
- mc.lineTo(Math.cos(i * Math.PI / 180) * k, Math.sin(i * Math.PI / 180) * k);
- }
- }
- function 画针(针名:String, sx:Number, sy:Number, 线粗:Number, 颜色:Number, 针长:Number) {
- this.createEmptyMovieClip(针名, this.getNextHighestDepth());
- with (eval(针名)) {
- lineStyle(线粗, 颜色);
- moveTo(0, 0);
- lineTo(0, 针长);
- _x = sx;
- _y = sy;
- }
- }
- //生成表格子短线
- this.createEmptyMovieClip("表格线0", this.getNextHighestDepth());
- with (表格线0) {
- lineStyle(2.5, 0x554444);
- moveTo(0, -96);
- lineTo(0, -92);
- _x = 100;
- _y = 100;
- }
- //复制并旋转表格短线
- for (i = 1; i < 12; i++) {
- duplicateMovieClip(表格线0, "表格线" + i, this.getNextHighestDepth());
- if (i == 3 || i == 6 || i == 9) {
- eval("表格线" + i)._width = 5;
- }
- eval("表格线" + i)._rotation = i * 30;
- }
- 表格线0._width = 5;
- //生成时针、分针、秒针
- 画针("时针", 100, 100, 4, 0x110000, -65);
- 画针("分针", 100, 100, 2, 0x332200, -80);
- 画针("秒针", 100, 100, 1, 0xff0000, -90);
- //生成一个MC并在其中画圆(边线)
- this.createEmptyMovieClip("钟体_mc", this.getNextHighestDepth());
- with (钟体_mc) {
- _x = 100;
- _y = 100;
- lineStyle(3, 0x332222);
- 画圆(钟体_mc, 98);
- beginFill(0x000000);
- 画圆(钟体_mc, 4);
- }
- //生成一个文本框,用来显示数字时间
- this.createTextField("厂家文本", this.getNextHighestDepth(), 62, 40, 0, 0);
- with (厂家文本) {
- autoSize = true;
- text = "我要好课件网";
- textColor = 0x663311;
- }
- this.createTextField("数字时钟", this.getNextHighestDepth(), 70, 170, 0, 0);
- 数字时钟.autoSize = true;
- 数字时钟.textColor = 0x661133;
- //钟
- this.onEnterFrame = function() {
- var 现在时间:Date = new Date();
- 时针._rotation = 现在时间.getHours() * 30 + 现在时间.getMinutes() / 2;
- 分针._rotation = 现在时间.getMinutes() * 6 + 现在时间.getSeconds() / 10;
- 秒针._rotation = 现在时间.getSeconds() * 6;
- 数字时钟.text = 一位数前补0(现在时间.getHours()) + "∶" + 一位数前补0(现在时间.getMinutes()) + "∶" + 一位数前补0(现在时间.getSeconds());
- delete 现在时间;
- };
复制代码 |
|