·您的位置: 首页 » 资源教程 » 创意设计 » Flash » AS签名等一些常用AS代码

AS签名等一些常用AS代码

类别: Flash教程  评论数:0 总得分:0
//显示时间
function get_time() {
var a = this.createEmptyMovieClip("time_show", 200412);
a.createTextField("time_text", 0, 0, 0, 140, 18);
a.time_text.background=true;
a.onEnterFrame = function () {
this.time_text.text = new Date().getFullYear()+"年"+new Date().getMonth()+"月"+new Date().getDay()+"日"+new Date().getHours()+":"+new Date().getMinutes()+":"+new Date().getSeconds();
};
}
get_time();

――――――――――――――――――――――――――
//显示帧速

function get_fps() {
var a = this.createEmptyMovieClip("fps_show", 100000);
a.createTextField("fps_text", 0, 0, 0, 16, 18);
a.fps_text.background = true;
a._fps = 0;
a.oldtim = getTimer();
a.onEnterFrame = function () {
this._fps = Math.round(1000 / (getTimer() - this.oldtim));
this.oldtim = getTimer();
this.fps_text.text = this._fps;
};
}
get_fps();
――――――――――――――――――――――
//AS填充,并获得填充区点阵
function get_fill(mc){
var s_j=mc._x;
var e_j=mc._x+mc._width;
var s_i=mc._y;
var e_i=mc._y+mc._height;
//
var a=mc.createEmptyMovieClip("fill",1);
var fill_data=[];
for(var i=0;i<100;i++){
fill_data[i]=[];
for(var j=0;j<25;j++){
if(mc.hitTest(i,j,true)){
a.lineStyle(1,random(0xffffff));
a.moveTo(i,j);
a.lineTo(i+.5,j);
fill_data[i][j]=1;
}else{
fill_data[i][j]=0;
}
}
}
for(var i in fill_data){
fill_data[i]=fill_data[i].join("");
}
fill_data=fill_data.join(",");
trace(fill_data);
return fill_data;
}
――――――――――――――――――――――
//我的AS签名
//取得填充区,并将信息存入fill_data(“1”需要表示填充,“0”表示无须填充)
function get_fill(mc){
var s_j=mc._x;
var e_j=mc._x+mc._width;
var s_i=mc._y;
var e_i=mc._y+mc._height;
//
var a=mc.createEmptyMovieClip("fill",1);
var fill_data=[];
for(var i=0;i<100;i++){
fill_data[i]=[];
for(var j=0;j<25;j++){
if(mc.hitTest(i,j,true)){
a.lineStyle(1,random(0xffffff));
a.moveTo(i,j);
a.lineTo(i+.5,j);
fill_data[i][j]=1;
}else{
fill_data[i][j]=0;
}
}
}
for(var i in fill_data){
fill_data[i]=fill_data[i].join("");
}
fill_data=fill_data.join(",");
trace(fill_data);
return fill_data;
}

下面的jh_data就是由函数get_fill(mc)取得的,mc中是被打散的字符,注册点位于左上角
//我的签名
function _jh7086() {
var jh_data="0000000000000000000000000, 0000000001100000000000000,0000000001100000000000000, 0000000001100000000001000,0011000001111111111111100, 0011111001111111111111100,0000110000000000000111000, 0000000000000000001110000,0000110000000000011100000, 0000110000000000000000011,0000110000011100011000111, 0000110000111000011100110,0000110011101000111001110, 0000111111001000110001100,0110110100001001100001100, 0111110000001111000111000,0111010000001110000110000, 0000110000111100011110000,0000110011110000111110000, 0000110011100011111111000,0000110001000111100011000, 0000110000000110000011100,0000110000000100000001110, 0000110000000000000000110,0000000000000000000000000, 0000000000000000000000000,0000000000000000000000000, 0000000000000000000000000,0000001111111111111111110, 0000001111111111111111110,0000001000000000000000000, 0110000000000000000000000,0111100000000000001000000, 0011100000000000011100000,0000000000000000110000000, 0000000000000011100000000,0000000000001110000000000, 0011001111111000000000000,0011001111111000000000000, 0011001000011100000000000,0011000000001110000000000,0011000000000111000000000, 0011000000000011110000000,0011000000000001111000000, 0011000000000000010000010,0011000000000000000000111, 0011000000000000000000110,0011111111111111111111110, 0011111111111111111111100,0000000000000000000000000, 0000000000000000000000000,0000000000000000000000000, 0000000000000000000000000,0000010000000000000001000, 0000010001101110001111000,0000010001111110011100000, 0000010001000110011000010,0000010001000110000000011, 0110010001000111111111111,0111010001000111111111111, 0011010001000110000000000,0000010001000110000000000, 0000010001111110111000000,0000010000000000001100110, 0000010000000000000001110,0000000010000000000111100, 0000000010000000011110000,0111111111111111111000000, 0111111111111000000000000,0100000010000000000000000, 0000000011111111111111100,0001000011111111111111110, 0011100010000000000000110,0000110010000000000000110, 0000010010000000000011110,0000000010000000000011100, 0000000000000000000000000,0000000000000000000000000, 0000000000000000000000000,0000000000000000000000000, 0000001110000000000001110,0000001111111111111111110, 0000001000000000000000000,0110000000000000000000000, 0111100000000000001000000,0011110000000000011100000, 0000100000000000111000000,0000000000000011100000000, 0000000000001110000000000,0011001111111000000000000, 0011001111111000000000000,0011001000011100000000000, 0011000000001110000000000,0011000000000111000000000, 0011000000000011110000000,001100000000000

1111000000, 0011000000000000010000010,0011000000000000000000111, 0011000000000000000000110, 0011111111111111111111110";
//数据预处理
jh_data=jh_data.split(",");
for(var i in jh_data){
jh_data[i]=jh_data[i].split("");
}
this.createEmptyMovieClip("jh7086", 1000000);
jh7086.onRelease=function(){
getURL("http://www.webjx.com";,_blank’" target="_blank" >http://www.webjx.com",_blank);
}
jh7086.onEnterFrame=function(){
this.clear();
this.lineStyle();
this.beginFill(0);
this.moveTo(0,0);
this.lineTo(110,0);
this.lineTo(110,32);
this.lineTo(0,32);
this.lineTo(0,0);
this.endFill();
//填字
for(var i=0 ;i<jh_data.length;i++){
for(var j=0 ;j<jh_data[i].length;j++){
if(jh_data[i][j]=="1"){
var col=random(150)+50;
this.lineStyle(2,(col+50)*256*256+col*256+100,100);
this.moveTo(i+4,j+3);
this.lineTo(i+4.5,j+3);
}
}
}
}
}
_jh7086() ;//执行这个函数就得到偶的签名


-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1