[主题] //创建空影片剪辑huaxian_mc
this.createEmptyMovieClip("huaxian_mc", this.getNextHighestDepth()); //初始化starthua和stophua的可见性 starthua._visible = 1; stophua._visible = 0; //starthua按下释放时执行下列语句 starthua.onRelease = function() { //更改starthua和stophua的可见性 stophua._visible = 1; this._visible = 0; //huaxian_mc中鼠标按下设置变量的值 huaxian_mc.onMouseDown = function() { start_x = _xmouse; start_y = _ymouse; hua = true; }; //huaxian_mc中鼠标移动执行 huaxian_mc.onMouseMove = function() { //画线范围 if (_root._ymouse>213 || _root._ymouse<7 || _root._xmouse>313 || _root._xmouse<7) { hua = false; } if (hua == true) { //线的粗细与颜色 this.lineStyle(2, 0xFF0000); //从按下鼠标的位置开始画线且只能按水平方向画线 this.moveTo(start_x, start_y); this.lineTo(_xmouse, start_y); //不断更新舞台 updateAfterEvent(); } //鼠标释放时停止画 this.onMouseUp = function() { hua = false; }; }; }; //starthua按下释放时执行下列语句 stophua.onRelease = function() { //更改starthua和stophua的可见性 this._visible = 0; starthua._visible = 1; //删除huaxian_mc按下鼠标 delete huaxian_mc.onMouseDown; }; //清除线 clearxian.onRelease = function() { huaxian_mc.clear(); }; (责任编辑:admin) |


