flash的as3.0怎么做让一个按钮按下后跟着鼠标指针拖拽
flash的as3.0怎么做让一个按钮按下后跟着鼠标指针拖拽rt,怎么做拖拽呢?然后就是怎么让他点一下旋转45度?...
flash的as3.0怎么做让一个按钮按下后跟着鼠标指针拖拽rt,怎么做拖拽呢?然后就是怎么让他点一下旋转45度?
展开
展开全部
import flash.display.Sprite;
import flash.events.MouseEvent;
//怎么做一个按钮
var sp:Sprite = new Sprite ();
sp.graphics.beginFill(0xff0000,1);
sp.graphics.drawRect(0,0,100,100);
sp.graphics.endFill();
sp.buttonMode = true;
addChild(sp);
sp.x = 200;
sp.y = 150;
//怎么做拖拽
sp.addEventListener(MouseEvent.MOUSE_DOWN,onMouse_Down);
sp.addEventListener(MouseEvent.MOUSE_UP,onMouse_Up);
function onMouse_Down(m:MouseEvent):void
{
m.target.startDrag();
}
function onMouse_Up(m:MouseEvent):void
{
m.target.stopDrag();
m.target.rotation -= 45;//怎么让他点一下旋转45度
}
import flash.events.MouseEvent;
//怎么做一个按钮
var sp:Sprite = new Sprite ();
sp.graphics.beginFill(0xff0000,1);
sp.graphics.drawRect(0,0,100,100);
sp.graphics.endFill();
sp.buttonMode = true;
addChild(sp);
sp.x = 200;
sp.y = 150;
//怎么做拖拽
sp.addEventListener(MouseEvent.MOUSE_DOWN,onMouse_Down);
sp.addEventListener(MouseEvent.MOUSE_UP,onMouse_Up);
function onMouse_Down(m:MouseEvent):void
{
m.target.startDrag();
}
function onMouse_Up(m:MouseEvent):void
{
m.target.stopDrag();
m.target.rotation -= 45;//怎么让他点一下旋转45度
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询