见有人提到,就试着做了一下。字母有点问题,是因为开始时以为是 6*8 的,后来发现是 7*8 的,懒得改了... 花了两小时。看看吧:(文章最后附有源文件)
以下是代码:
function zhi(size, words, __X, __Y, color_LINE, color_LED, move, Num) {
squ_size = size;
for (var j = 0; j<=48; j++) {
this["point_"+(j+1)] = [];
this["point_"+(j+1)].push(j*squ_size-Math.floor(j/6)*squ_size*6);
this["point_"+(j+1)].push(Math.floor(j/6)*squ_size);
}
//trace(this["point_"+6]);
A = [3, 4, 9, 10, 14, 17, 20, 23, 26, 29, 31, 32, 33, 34, 35, 36, 37, 42, 43, 48];
B = [1, 2, 3, 4, 5, 7, 12, 13, 18, 19, 20, 21, 22, 23, 25, 30, 31, 36, 37, 42, 43, 44, 45, 46, 47];
C = [3, 4, 5, 8, 12, 13, 19, 25, 31, 38, 42, 45, 46, 47];
D = [1, 2, 3, 4, 7, 11, 13, 18, 19, 24, 25, 30, 31, 36, 37, 41, 43, 44, 45, 46];
E = [1, 2, 3, 4, 5, 7, 13, 19, 20, 21, 22, 25, 31, 37, 43, 44, 45, 46, 47];
F = [1, 2, 3, 4, 5, 7, 13, 19, 20, 21, 22, 25, 31, 37, 43];
G = [3, 4, 5, 8, 12, 13, 19, 25, 28, 29, 30, 31, 36, 38, 42, 45, 46, 47];
H = [1, 5, 7, 11, 13, 17, 19, 20, 21, 22, 23, 25, 29, 31, 35, 37, 41, 43, 47];
I = [1, 2, 3, 8, 14, 20, 26, 32, 38, 43, 44, 45];
J = [3, 4, 10, 16, 22, 28, 34, 40, 43, 44, 45];
K = [1, 6, 7, 11, 13, 16, 19, 21, 25, 26, 27, 31, 34, 37, 41, 43, 48];
L = [1, 7, 13, 19, 25, 31, 37, 43, 44, 45, 46, 47];
M = [1, 6, 7, 12, 13, 14, 17, 18, 19, 21, 22, 24, 25, 27, 28, 30, 31, 36, 37, 42, 43, 48];
N = [1, 2, 6, 7, 8, 12, 13, 15, 18, 19, 21, 24, 25, 28, 30, 31, 34, 36, 37, 41, 42, 43, 47, 48];
O = [2, 3, 4, 5, 7, 12, 13, 18, 19, 24, 25, 30, 31, 36, 37, 42, 44, 45, 46, 47];
P = [1, 2, 3, 4, 5, 7, 12, 13, 18, 19, 20, 21, 22, 23, 25, 31, 37, 43];
Q = [2, 3, 4, 5, 7, 12, 13, 18, 19, 24, 25, 30, 32, 33, 34, 35, 40, 47, 48];
R = [1, 2, 3, 4, 5, 7, 12, 13, 18, 19, 20, 21, 22, 23, 25, 27, 31, 34, 37, 41, 43, 48];
S = [2, 3, 4, 5, 7, 13, 20, 27, 28, 29, 36, 42, 43, 44, 45, 46, 47];
T = [1, 2, 3, 4, 5, 9, 15, 21, 27, 33, 39, 45];
U = [1, 6, 7, 12, 13, 18, 19, 24, 25, 30, 31, 36, 37, 42, 44, 45, 46, 47];
V = [1, 6, 7, 12, 13, 18, 19, 24, 25, 30, 31, 36, 38, 41, 45, 46];
W = [1, 6, 7, 12, 13, 18, 19, 24, 25, 27, 28, 30, 31, 33, 34, 36, 37, 38, 41, 42, 43, 48];
X = [1, 6, 7, 12, 14, 17, 21, 22, 27, 28, 32, 35, 37, 42, 43, 48];
Y = [1, 5, 7, 11, 14, 16, 21, 27, 33, 39, 45];
Z = [1, 2, 3, 4, 5, 6, 12, 17, 21, 27, 32, 37, 43, 44, 45, 46, 47, 48];
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (var jj = 0; jj<=letters.length; jj++) {
this["Arr_"+letters.charAt(jj)] = [];
for (var j = 0; j<this[letters.charAt(jj)].length; j++) {
this["Arr_"+letters.charAt(jj)].push("point_"+this[letters.charAt(jj)][j]);
}
}
_root.createEmptyMovieClip("squ", getNextHighestDepth());
_root.squ.beginFill(color_LED, 100);
_root.squ.lineStyle(0, color_LINE);
_root.squ.lineTo(squ_size, 0);
_root.squ.lineTo(squ_size, squ_size);
_root.squ.lineTo(0, squ_size);
_root.squ.lineTo(0, 0);
_root.squ._visible = 0;
dep = 0;
zhiju = squ_size*7;
Y = __Y;
X = __X;
word = words;
for (var jj = 0; jj<word.length; jj++) {
for (var j = 0; j<this["Arr_"+word.charAt(jj)].length; j++) {
_root.dep++;
__x = this[this["Arr_"+this.word.charAt(jj)][j]][0];
__y = this[this["Arr_"+this.word.charAt(jj)][j]][1];
squ.duplicateMovieClip("squ"+dep, _root.getNextHighestDepth(), {_x:__x+jj*zhiju+X, _y:__y+Y});
}
}
_root.lineStyle(0, color_LINE);
for (var j = 0; j<=10; j++) {
_root.moveTo(X, squ_size*j+Y-squ_size);
_root.lineTo(X+squ_size*40, squ_size*j+Y-squ_size);
}
for (var j = 0; j<=40; j++) {
_root.moveTo(squ_size*j+X, Y-squ_size);
_root.lineTo(squ_size*j+X, Y+squ_size*9);
}
if (move) {
for (var j = 0; j<=dep; j++) {
_root["squ"+j]._x += 200;
_root["squ"+j].onEnterFrame = function() {
this._x -= size;
this._x<X ? this._x += squ_size*word.length*size : "闪吧 kingofkofs";
if (this._x>size*6*5+zhiju*Num) {
this._visible = false;
} else {
this._visible = true;
}
};
}
}
}
zhi(8, "HELLO JIE RI KUAI LE,WO SHI KINGOFKOFS", 120, 150, 0x000000, 0x0000FF, true, 3.5);
//by kingofkofs 2007.12.26 18:00
源文件下载:
LED.rar进入论坛和作者讨论学习:
http://space.flash8.net/bbs/thread-347875-1-1.html