ActionScript 3 油漆-O-MATIC

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 油漆-O-MATIC相关的知识,希望对你有一定的参考价值。

import flash.events.MouseEvent;
import flash.geom.Matrix;
//
// flag per il detect del mousedown
var md:Boolean = false;
//
// creo una lavagna front
var lvg1:Sprite = new Sprite();
lvg1.graphics.lineStyle(0,0xffffff);
lvg1.graphics.beginFill(0x666666);
lvg1.graphics.drawRect(0,0,199,199);
lvg1.graphics.endFill();
addChild(lvg1);
lvg1.x = lvg1.y = 30;
//
// creo la lavagna inclinata
var lvg2:Sprite = new Sprite();
lvg2.graphics.lineStyle(0,0xffffff);
lvg2.graphics.beginFill(0x666666);
lvg2.graphics.drawRect(0,0,199,199);
lvg2.graphics.endFill();
lvg2.x = 400;
lvg2.y = lvg1.y;
lvg2.rotation = 45;
lvg2.scaleX = lvg2.scaleY = .6;
addChild(lvg2);
//
// paint event
lvg1.addEventListener (MouseEvent.MOUSE_DOWN, _onMouseDown);
lvg1.addEventListener (MouseEvent.MOUSE_MOVE, _onMouseMove);
lvg1.addEventListener (MouseEvent.MOUSE_UP, _onMouseUp);
//
function _onMouseDown (e:MouseEvent):void {
	trace("_onMouseDown");
	var c:uint = 0xffffff;
	e.target.graphics.lineStyle (10,c,1);
	lvg2.graphics.lineStyle (10,c,1);
	e.target.graphics.moveTo (e.localX,e.localY);
	lvg2.graphics.moveTo (e.localX,e.localY);
	md = true;
}
//
function _onMouseUp (e:MouseEvent):void {
	md = false;
}
//
function _onMouseMove (e:MouseEvent):void {
	trace("_onMouseMove");
	if (md)  {
		e.target.graphics.lineTo (e.localX,e.localY);
		lvg2.graphics.lineTo (e.localX,e.localY);
	}
}

以上是关于ActionScript 3 油漆-O-MATIC的主要内容,如果未能解决你的问题,请参考以下文章

JN 刷墙 过程DP

Photoshop 基础四 填充(渐变油漆桶)

opencv-python实现PS中的油漆填充功能3 多坐标一次性填充

油漆()和油漆组件()之间的区别?

设计模式之Decorator(油漆工)(转)

油漆工施工工序