0
에는 actionscript에서 마우스로 상호 작용할 수있는 객체를 만드는 쉬운 방법이 있습니다. 몇 줄의 코드가있는 것처럼 보입니까?대화 형 개체?
에는 actionscript에서 마우스로 상호 작용할 수있는 객체를 만드는 쉬운 방법이 있습니다. 몇 줄의 코드가있는 것처럼 보입니까?대화 형 개체?
var sprite:Sprite = new Sprite(); // create a new sprite.
sprite.graphics.beginFill(0); // set fill color to black
sprite.graphics.drawRect(0,0,100,100); // draw a square
addChild(sprite); // add the sprite to the display list making it appear on screen.
sprite.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); // add responders for mouse interaction.
sprite.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
function onMouseDown(event:MouseEvent):void {
// When the mouse button is released over the object, this code executes.
Sprite(event.target).startDrag(); // make the object follow the mouse.
}
function onMouseUp(event:MouseEvent):void {
// When the mouse button is pressed over the object, this code executes.
Sprite(event.target).stopDrag(); // make the object stop following the mouse.
}
이 질문은 명확하지 않습니다. 어떻게 그들과 상호 작용하고 싶은지 더 설명해 주시겠습니까? –