资源描述:
《一个用纯as写的正态曲线画法》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、一个用纯AS写的正态曲线画法我的这段AS写了不少有用的函数,如画按钮函数,画坐标轴函数,画框架函数.这些函数都有很强的移植性,以后都可以直接拿来用;//================按钮和坐标轴上的文字=====================//mytxt=["开始","暂停","清除","全屏","退出","继续"];myNum=["-30","-20","-10","0","10","20","30","X","Y"];//=====画按钮(type不为0时按钮为凸起状态type=0时按钮为凹下状态)=====//m
2、andButton=function(mc,t,type){c=0xffffff;//按钮左和上边框颜色c1=0x000000;//按钮右和下边框颜色mc.createTextField("txt",700,12,1,27,18);if(!type){c=0x000000;c1=0xffffff;//type=0时左和上与右和下边框颜色交换;mc.createTextField("txt",700,13,2,27,18);//按下时文本框向左下移,使字有凹下感觉}c){moveTo(0,20);lineStyle(1,c,1
3、00);beginFill(0xD1DEE9);lineTo(0,0);lineTo(50,0);lineStyle(1,c1,100);lineTo(50,20);lineTo(0,20);endFill();txt.text=t;}};//===========画框架=============//display=function(mc,x,y,c){moveTo(x,y);lineStyle(0.5,0x00000,100);beginFill(corl,40);lineTo(x+e",300,x+2,y-17,0,0)
4、;name.autoSize="left";name.selectable=false;name.border=true;name.background=true;name.backgroundColor=0x798DA6;name.textColor=0xffffff;name.text=txt;}};//========画坐标轴上刻度及数字==============//dial=function(mc,len,corl,txt,type){c){moveTo(0,0);lineStyle(0.25,corl,100);
5、if(type){//type不为0时刻度坚着画,为0时刻度横着画;lineTo(0,len);createTextField("num",600,-7,len+1,0,0);}else{lineTo(len,0);createTextField("num",600,len+1,-2,0,0);}num.autoSize=true;num.selectable=false;num.text=txt;}};//========画坐标轴============//coordinate=function(x,y){_root.mo
6、veTo(x-215,y);_root.lineStyle(0.25,0x00000,100);_root.lineTo(x+215,y);_root.lineTo(x+185,y+5);_root.moveTo(x+215,y);_root.lineTo(x+185,y-5);_root.moveTo(x,y+20);_root.lineTo(x,y-220);_root.lineTo(x-5,y-190);_root.moveTo(x,y-220);_root.lineTo(x+5,y-190);for(i=0;i<
7、;19;i++){_root.createEmptyMovieClip("l"+i,510+i);if(i<13){!(i%2)?dial(_root["l"+i],5,0xff0000,myNum[i/2],1):dial(_root["l"+i],3,0x000000,"",1);//刻度隔一个为红色,且有数字_root["l"+i]._x=x-198+33*i;_root["l"+i]._y=y;}if(i>12){//同上!(i%2)?dial(_root["l"+i],5,0xff0000,myNum[
8、i/2-3],0):dial(_root["l"+i],3,0x000000,"",0);_root["l"+i]._x=x;_root["l"+i]._y=y-33*(i-12);}}_root.createTextField("Xt",250,x+220,y-3,18,18);_roo