if (Key.isDown(2)){ trace("asdfjsdjkf"); } } 实现TAB功能 获得焦点 使用Selection.setfocus()函数 举个例子: 例如你在主影片中有N个文本框,变量分别为text1,text2.....你想使影片一播放就把焦点落到第一个 文本框你就在第一FRAME 加AS如下: Selection.setfocus("_root.text1"); 我们可以举一反三 实现TAB功能 二 把这个N个文本框做组成一个数组 numarray=new array("_root.text1","_root.text2",....................."_root.textn"); 首先获得鼠标焦点 x=Selection.getfocus();/* x 获得鼠标焦点的一个字符串 for(i=0;i<=n;i++) { if(numarray==x){ num=i; /*获得当前焦点在数组中的位置 } 然后编写TAB键功能 on (keyPress "") { if (num==n){num=0;} else{num++;} Selection.setfocus(numarray[num]); } 按钮能像window那样用Tab键来转换选择 用button.onKillFoucus *两点间画直线 *画螺旋线 *画正方形、圆、椭圆 *抛物线 *正弦、余弦线 使用方法:加到帧中就可 // 画直线 // / x1, y1: 起点坐标 // x2, y2: 终点坐标 // k是层次 Movieclip.prototype.drawline = function(x1, y1, x2, y2, k) { this.linestyle(1); this.moveTo(x1, y1); this.lineTo(x2, y2); }; // 从(0,0)到(100,100)画一条线 _root.createEmptyMovieClip("mc", 10); mc.drawline(0, 0, 100, 100); // 画螺旋线 // w、h为宽和高 // f控制线的长短,用弧度表示 Movieclip.prototype.drawhelix = function(w, h, f) { for (var i = 0; ithis.lineTo(x=Math.sin(i)*i*w, y=Math.cos(i)*i*h); this.linestyle(1); } }; // 以(100,100)为中心画螺旋线 _root.createEmptyMovieClip("luo", 1); with (luo) { drawhelix(5, 5, 13); _x += 100; _y += 100; } // 多功能函数,可画圆,椭圆,正多边形等 // n为边数 Movieclip.prototype.drawmany = function(w, h, n) { f = 2*Math.PI; for (var i = 0; i<=f/n*(n+1); i += f/n) { this.lineTo(x=Math.sin(i)*w, y=Math.cos(i)*h); this.linestyle(1); } }; // 画一正五边形 _root.createEmptyMovieClip("duobian", 2); with (duobian) { drawmany(50, 50, 5); _x += 250; _y += 100; // 5为多边形的边数,6.3为2pai } // 画一椭圆 _root.createEmptyMovieClip("tuo", 3); with (tuo) { drawmany(25, 50, 100); _x += 400; _y += 100; } // 圆 _root.createEmptyMovieClip("yuan", 4); with (yuan) { drawmany(50, 50, 100); _x += 400; _y += 300; } // 抛物线 Movieclip.prototype.drawparabola = function(l, r, k) { for (var i = -l; i<=r; i += 1) { this.lineTo(x=i, y=k*i*i); this.linestyle(1); } }; // 调用 _root.createEmptyMovieClip("parabola", 100); with (parabola) { drawparabola(50, 50, 0.05); _x += 200; _y += 200; // 顶点坐标 } // 正弦线,余弦类似 Movieclip.prototype.drawsin = function(n, k) { for (var i = 0; i<=90*n; i += 1) { this.lineTo(x=i, y=k*Math.sin(i*Math.PI/180)); this.linestyle(1); } }; _root.createEmptyMovieClip("sin", 101); with (sin) { drawsin(4, 50); _x += 200; _y += 200; // 顶点坐标 } Movieclip.prototype.drawwave = function(w, h) { for (var i = 0; i<=6.3; i += 0.01) { this.lineTo(x=w/Math.cos(i), y=h*Math.sin(i)/Math.cos(i)); this.linestyle(1); } }; _root.createEmptyMovieClip("wave", 105); with (wave) { drawwave(100, 100); _x += 200; _y += 200; // 顶点坐标 } 一个动态文本设置alpha函数。 function setAlpha(obj,alpha){ var rgb="0x"+(255*(100-alpha)/100).toString(16); 上一页 [1] [2] [3] [4] [5] [6] [7] 下一页 图片" onclick="javascript:window.open(this.src);" onmousewheel="return bbimg(this)" onload="javascript:resizepic(this)" border="0"/>
[]
|