最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
flash图鸭效果
时间:2022-07-02 17:04:55 编辑:袖梨 来源:一聚教程网
先看看代码:
import .display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.Matrix;
import flash.geom.ColorTransform;
//建立显示mc
this.createEmptyMovieClip("main", this.getNextHighestDepth());
main.createEmptyMovieClip("mc", main.getNextHighestDepth());
main.createEmptyMovieClip("show", main.getNextHighestDepth());
var content:BitmapData = new BitmapData(550,440,true,0x00FFFFFF);
main.show.attachBitmap(content,0)
//默认选中画笔
var action:Number = 0
txt.text = "当前选中:画笔"
mc_move.onPress = goDraw
//选中画笔
a.onPress = function(){
action = 0
txt.text = "当前选中:画笔"
main.mc._visible = true
mc_move.onPress = goDraw
}
//选中橡皮
b.onPress = function(){
action = 1
txt.text = "当前选中:橡皮"
main.mc._visible = false
mc_move.onPress = goDraw
}
//放开鼠标
mc_move.onRelease = function(){
delete onMouseMove
content.draw(main,new Matrix(),new ColorTransform(),1,new Rectangle(0,0,550,400))
main.mc.clear()
break;
}
mc_move.onReleaseOutside = mc_move.onRelease
//画线
function goDraw(){
main.mc.lineStyle(20)
main.mc.moveTo(_xmouse,_ymouse)
onMouseMove = function(){
main.mc.lineTo(_xmouse,_ymouse)
updateAfterEvent()
if(action==1){
//主要的代码,在使用橡皮的时候(action==1),draw的时候,"混合模式"选择12(第四个参数)
content.draw(main.mc,new Matrix(),new ColorTransform(),12)
}
}
}
import flash.geom.Rectangle;
import flash.geom.Matrix;
import flash.geom.ColorTransform;
//建立显示mc
this.createEmptyMovieClip("main", this.getNextHighestDepth());
main.createEmptyMovieClip("mc", main.getNextHighestDepth());
main.createEmptyMovieClip("show", main.getNextHighestDepth());
var content:BitmapData = new BitmapData(550,440,true,0x00FFFFFF);
main.show.attachBitmap(content,0)
//默认选中画笔
var action:Number = 0
txt.text = "当前选中:画笔"
mc_move.onPress = goDraw
//选中画笔
a.onPress = function(){
action = 0
txt.text = "当前选中:画笔"
main.mc._visible = true
mc_move.onPress = goDraw
}
//选中橡皮
b.onPress = function(){
action = 1
txt.text = "当前选中:橡皮"
main.mc._visible = false
mc_move.onPress = goDraw
}
//放开鼠标
mc_move.onRelease = function(){
delete onMouseMove
content.draw(main,new Matrix(),new ColorTransform(),1,new Rectangle(0,0,550,400))
main.mc.clear()
break;
}
mc_move.onReleaseOutside = mc_move.onRelease
//画线
function goDraw(){
main.mc.lineStyle(20)
main.mc.moveTo(_xmouse,_ymouse)
onMouseMove = function(){
main.mc.lineTo(_xmouse,_ymouse)
updateAfterEvent()
if(action==1){
//主要的代码,在使用橡皮的时候(action==1),draw的时候,"混合模式"选择12(第四个参数)
content.draw(main.mc,new Matrix(),new ColorTransform(),12)
}
}
}
相关文章
- 番库acg漫画汉化入口免费看-里番本子库绅士acg官网地址全收录 02-15
- 樱花动漫下载入口安卓版-樱花动漫2026最新版安装包免费下载 02-15
- 快手极速版网页版-快手极速版官网入口 02-15
- ao3网页版登录入口直达2026-ao3官网登录入口2026 02-15
- 职教云最新登录通道-职教云官方安全认证入口 02-15
- 无限暖暖-云游戏入口在哪-无限暖暖-网页版地址 02-15