Flash as入门(16):用AS绘制各种图形

http://www.webjx.com/  2009-01-24 10:59:16  来源:中国教程网 sanbos 

Webjx核心提示:本例继续讲解AS的基础知识,今天我们来学习Flash AS入门系列教程第七课:影片剪辑第10节用AS绘图,教程详细讲解了运用AS绘制各种图形的方法,对Flash的AS编程有兴趣的朋友可以到论坛与作者交流.

涂雅板的制作:

效果如下,在左边选择颜色和粗细后,可在右边绘图。

按下图画好图形,并将每个图形转换为MC.

 

实例名称:

黑色-hs_mc;
红色-hongs_mc;
橙色-cs_mc;
黄色-huans_mc;
绿色-lus_mc;
蓝色_nans_mc;
紫色-zs_mc;
大园-m6_mc;
二园-m4_mc;
三园_m3_mc;
幺园-m1_mc;
新插入一层,打开帧动作面板,输入:
var color = 0x000000;
var dx =1;
var h:Boolean = true;
hs_mc.onRelease = function (){
color = 0x000000;
}
hongs_mc.onRelease = function (){
color = 0xFF0000;
}
cs_mc.onRelease = function (){
color = 0xFF9900;
}
huans_mc.onRelease = function (){
color = 0xFFFF00;
}
lus_mc.onRelease = function (){
color = 0x00FF00;
}
nans_mc.onRelease = function (){
color = 0x0000FF;
}
zs_mc.onRelease = function (){
color = 0xFF00FF;
}
m1_mc.onRelease = function(){
dx = 1;
}
m3_mc.onRelease = function(){
dx = 3;
}
m4_mc.onRelease = function(){
dx = 4;
}
m6_mc.onRelease = function(){
dx = 6;
}
onMouseDown = function(){
if(_xmouse >170){
h=true;
}
lineStyle(dx,color,100);
moveTo(_xmouse,_ymouse);
}
onMouseMove = function(){
if(_xmouse <170){
h=false;
}
if(h){
lineTo(_xmouse,_ymouse);
}
}
onMouseUp= function(){
h=false;;
}

更多