Flash AS入门教程第七课:影片剪辑第10节用AS绘图
2009-12-12 00:00:00 来源:WEB开发网差不多了,再做两个练习,一个是涂鸦板的制作,一个是动态引导线的效果。
涂雅板的制作:
效果如下,在左边选择颜色和粗细后,可在右边绘图。
按下图画好图形,并将每个图形转换为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;;
}
鼠绘引导线:
效果如下:用鼠标画一条引导线,小球将按引导线运动.
画一个球,或者你喜欢的任何玩意儿,转换为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();
};
}
};
- ››ASP.NET及JS中的cookie基本用法
- ››ASP.NET获取MS SQL Server安装实例
- ››asp.net实现调用百度pai 在线翻译英文转中文
- ››ASP.NET页面选项进行提示判断
- ››Asp.net定时执行程序
- ››ASP.NET中利用DataList实现图片无缝滚动
- ››ASP.NET验证控件RequiredFieldValidator
- ››ASP.NET中使用System.Net.Mail发邮件
- ››ASP.NET中获取用户控件中控件的ID
- ››ASP.NET中FileBytes写成文件并存档
- ››asp获取毫秒数
- ››asp.net报“INSERT INTO 语句的语法错误解决
更多精彩
赞助商链接