Flash AS画线方法.docx
- 文档编号:7718472
- 上传时间:2023-01-26
- 格式:DOCX
- 页数:9
- 大小:15.25KB
Flash AS画线方法.docx
《Flash AS画线方法.docx》由会员分享,可在线阅读,更多相关《Flash AS画线方法.docx(9页珍藏版)》请在冰豆网上搜索。
FlashAS画线方法
FlashAS画线方法
给大家简单介绍一下Flash中使用AS来画线,从下面这个函数开始吧!
_root.createEmptyMovieClip("terrain",1);
这个函数的功能是创建一个空的MC,名字为terrain。
然后开始画线:
_
root.terrain.lineStyle(10,0xff0000,100);
10代表线的粗细;0xff0000代表线颜色;100代表线的alpha为100。
你可以查看一下手册lineStyle函数的使用。
下面开始具体给出画线的代码:
画红色矩形:
createEmptyMovieClip("terrain",1);
terrain.lineStyle(10,0xff00ff,100);
terrain.moveTo(100,100);
terrain.lineTo(300,100);
terrain.lineTo(300,300);
terrain.lineTo(100,300);
terrain.lineTo(100,100);
鼠标画线:
createEmptyMovieClip("terrain",1);
terrain.lineStyle(10,0xff00ff,100);
onEnterFrame=function(){
terrain.lineTo(_xmouse,_ymouse);
};
只有按一下鼠标才能画:
createEmptyMovieClip("terrain",1);
terrain.lineStyle(10,0xff00ff,100);
imdrawing=false;
onMouseDown=function(){
if(imdrawing==false){
terrain.moveTo(_xmouse,_ymouse);
imdrawing=true;
}
if(imdrawing==true){
onEnterFrame=function(){
terrain.lineTo(_xmouse,_ymouse);
};
}
};
onMouseUp=function(){
onEnterFrame=function(){
imdrawing=false;
};
};
添加一些其它的画线效果:
importflash.filters.BevelFilter;
vardistance:
Number=2;
varangleInDegrees:
Number=45;
varhighlightColor:
Number=0xff00ff;
varhighlightAlpha:
Number=1;
varshadowColor:
Number=0xbb00bb;
varshadowAlpha:
Number=1;
varblurX:
Number=8;
varblurY:
Number=8;
varstrength:
Number=10;
varquality:
Number=3;
vartype:
String="inner";
varknockout:
Boolean=false;
varmy_bevel_filter:
BevelFilter=newBevelFilter(distance,angleInDegrees,highlightColor,highlightAlpha,shadowColor,
shadowAlpha,blurX,blurY,strength,quality,type,knockout);
createEmptyMovieClip("terrain",1);
terrain.lineStyle(20,0xdd00dd,100);
terrain.filters=newArray(my_bevel_filter);
imdrawing=false;
onMouseDown=function(){
if(imdrawing==false){
terrain.moveTo(_xmouse,_ymouse);
imdrawing=true;
}
if(imdrawing==true){
onEnterFrame=function(){
terrain.lineTo(_xmouse,_ymouse);
};
}
};
onMouseUp=function(){
onEnterFrame=function(){
imdrawing=false;
};
};
模糊效果画线:
importflash.filters.BlurFilter;
varblurX:
Number=30;
varblurY:
Number=30;
varquality:
Number=3;
varmy_blur_filter:
BlurFilter=newBlurFilter(blurX,blurY,quality);
createEmptyMovieClip("terrain",1);
terrain.lineStyle(20,0xdd00dd,100);
terrain.filters=newArray(my_blur_filter);
imdrawing=false;
onMouseDown=function(){
if(imdrawing==false){
terrain.moveTo(_xmouse,_ymouse);
imdrawing=true;
}
if(imdrawing==true){
onEnterFrame=function(){
terrain.lineTo(_xmouse,_ymouse);
};
}
};
onMouseUp=function(){
onEnterFrame=function(){
imdrawing=false;
};
};
发光效果画线代码:
importflash.filters.GlowFilter;
varcolor:
Number=0x33CCFF;
varalpha:
Number=.8;
varblurX:
Number=35;
varblurY:
Number=35;
varstrength:
Number=2;
varquality:
Number=3;
varinner:
Boolean=false;
varknockout:
Boolean=false;
varmy_glow_filter:
GlowFilter=newGlowFilter(color,alpha,blurX,blurY,strength,quality,inner,knockout);
createEmptyMovieClip("terrain",1);
terrain.lineStyle(20,0xdd00dd,100);
terrain.filters=newArray(my_glow_filter);
imdrawing=false;
onMouseDown=function(){
if(imdrawing==false){
terrain.moveTo(_xmouse,_ymouse);
imdrawing=true;
}
if(imdrawing==true){
onEnterFrame=function(){
terrain.lineTo(_xmouse,_ymouse);
};
}
};
onMouseUp=function(){
onEnterFrame=function(){
imdrawing=false;
};
};
效果:
画阴影线的代码:
importflash.filters.DropShadowFilter;
vardistance:
Number=20;
varangleInDegrees:
Number=45;
varcolor:
Number=0x000000;
varalpha:
Number=.8;
varblurX:
Number=16;
varblurY:
Number=16;
varstrength:
Number=1;
varquality:
Number=3;
varinner:
Boolean=false;
varknockout:
Boolean=false;
varhideObject:
Boolean=false;
varmy_shadow_filter:
DropShadowFilter=newDropShadowFilter(distance,angleInDegrees,color,alpha,blurX,blurY,strength,quality,inner,knockout,hideObject);
createEmptyMovieClip("terrain",1);
terrain.lineStyle(20,0xdd00dd,100);
terrain.filters=newArray(my_shadow_filter);
imdrawing=false;
onMouseDown=function(){
if(imdrawing==false){
terrain.moveTo(_xmouse,_ymouse);
imdrawing=true;
}
if(imdrawing==true){
onEnterFrame=function(){
terrain.lineTo(_xmouse,_ymouse);
};
}
};
onMouseUp=function(){
onEnterFrame=function(){
imdrawing=false;
};
};
效果:
上面所有效果都混合在一起:
//bevelfilter
importflash.filters.BevelFilter;
vardistance:
Number=5;
varangleInDegrees:
Number=45;
varhighlightColor:
Number=0xFFFF00;
varhighlightAlpha:
Number=.8;
varshadowColor:
Number=0x0000FF;
varshadowAlpha:
Number=.8;
varblurX:
Number=5;
varblurY:
Number=5;
varstrength:
Number=5;
varquality:
Number=3;
vartype:
String="inner";
varknockout:
Boolean=false;
varmy_bevel_filter:
BevelFilter=newBevelFilter(distance,angleInDegrees,highlightColor,highlightAlpha,shadowColor,
shadowAlpha,blurX,blurY,strength,quality,type,knockout);
//blurfilter
importflash.filters.BlurFilter;
varblurX:
Number=30;
varblurY:
Number=30;
varquality:
Number=3;
varmy_blur_filter:
BlurFilter=newBlurFilter(blurX,blurY,quality);
//shadow
importflash.filters.DropShadowFilter;
vardistance:
Number=20;
varangleInDegrees:
Number=45;
varcolor:
Number=0x000000;
varalpha:
Number=.8;
varblurX:
Number=16;
varblurY:
Number=16;
varstrength:
Number=1;
varquality:
Number=3;
varinner:
Boolean=false;
varknockout:
Boolean=false;
varhideObject:
Boolean=false;
varmy_shadow_filter:
DropShadowFilter=newDropShadowFilter(distance,angleInDegrees,color,alpha,blurX,blurY,strength,quality,inner,knockout,hideObject);
//glow
importflash.filters.GlowFilter;
varcolor:
Number=0x33CCFF;
varalpha:
Number=.8;
varblurX:
Number=35;
varblurY:
Number=35;
varstrength:
Number=2;
varquality:
Number=3;
varinner:
Boolean=false;
varknockout:
Boolean=false;
varmy_glow_filter:
GlowFilter=newGlowFilter(color,alpha,blurX,blurY,strength,quality,inner,knockout);
_root.createEmptyMovieClip("terrain",1);
_root.terrain.lineStyle(10,0xff00ff,100);createEmptyMovieClip("terrain",1);
terrain.lineStyle(20,0xdd00dd,100);
terrain.filters=newArray(my_shadow_filter,my_glow_filter,my_blur_filter,my_bevel_filter);
imdrawing=false;
onMouseDown=function(){
if(imdrawing==false){
terrain.moveTo(_xmouse,_ymouse);
imdrawing=true;
}
if(imdrawing==true){
onEnterFrame=function(){
terrain.lineTo(_xmouse,_ymouse);
};
}
};
onMouseUp=function(){
onEnterFrame=function(){
imdrawing=false;
};
};
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Flash AS画线方法 AS 画线 方法