WEB开发网
开发学院图形图像Flash Flash AS入门教程第七课:影片剪辑第10节用AS绘图... 阅读

Flash AS入门教程第七课:影片剪辑第10节用AS绘图

 2009-12-12 00:00:00 来源:WEB开发网   
核心提示: 差不多了,再做两个练习,Flash AS入门教程第七课:影片剪辑第10节用AS绘图(7),一个是涂鸦板的制作,一个是动态引导线的效果,涂雅板的制作:效果如下,在左边选择颜色和粗细后

差不多了,再做两个练习,一个是涂鸦板的制作,一个是动态引导线的效果。

涂雅板的制作:

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

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

Flash AS入门教程第七课:影片剪辑第10节用AS绘图

实例名称:

黑色-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;; 
}

鼠绘引导线:

效果如下:用鼠标画一条引导线,小球将按引导线运动.

画一个球,或者你喜欢的任何玩意儿,转换为MC,实例名称为:ball_mc.

然后在帧动作面板中输入:

var a:Array; 
this.onMouseDown = function() { 
this.lineStyle(1, 0x0000ff, 100); 
a = new Array(); 
a.push(_xmouse, _ymouse); 
this.moveTo(_xmouse, _ymouse); 
this.onMouseMove = function() { 
a.push(_xmouse, _ymouse); 
this.lineTo(_xmouse, _ymouse); 
}; 
}; 
this.onMouseUp = function() { 
delete this.onMouseMove; 
var z:Number = new Number(); 
this.onEnterFrame = function() { 
ball_mc._x = a[z++]; 
ball_mc._y = a[z++]; 
if(z>a.length){ 
delete onEnterFrame; 
this.clear(); 
}; 
} 
};

上一页  2 3 4 5 6 7 

Tags:Flash AS 入门教程

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接