在flash cs6中 用as2在课件上画线 并且每条都可以选中删除
时间: 2024-06-06 07:07:11 浏览: 160
以下是一个示例代码,可以在Flash CS6中使用AS2语言在课件上画线并选择删除每条线:
//创建画板
var drawingBoard:MovieClip = this.createEmptyMovieClip("drawingBoard", this.getNextHighestDepth());
//设置画笔颜色和粗细
drawingBoard.lineStyle(2, 0xFF0000, 100);
//设置画板鼠标事件
drawingBoard.onPress = function() {
//开始绘制一条线
this.moveTo(this._xmouse, this._ymouse);
this.onMouseMove = function() {
//绘制中...
this.lineTo(this._xmouse, this._ymouse);
}
}
drawingBoard.onRelease = function() {
//停止绘制
delete this.onMouseMove;
//创建一个新的MovieClip来存储这条线
var line:MovieClip = this.createEmptyMovieClip("line" + this.getNextHighestDepth(), this.getNextHighestDepth());
//将这条线画在新的MovieClip上
line.lineStyle(2, 0xFF0000, 100);
line.moveTo(this._xmouse, this._ymouse);
line.lineTo(this._xmouse, this._ymouse);
line.lineTo(this._xmouse, this._ymouse);
//为这条线设置鼠标事件,使其可以被选择和删除
line.onRollOver = function() {
this._alpha = 50;
this.onPress = function() {
this._parent.removeChild(this);
}
}
line.onRollOut = function() {
this._alpha = 100;
delete this.onPress;
}
}
阅读全文