Copy link to clipboard
Copied
//as3 deafult code snippent for drag and drop
circle.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_3);
function fl_ClickToDrag_3(event:MouseEvent):void
{
circle.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_3);
function fl_ReleaseToDrop_3(event:MouseEvent):void
{
circle.stopDrag();
}
i just tried to convert this createjs code . but my code not working
/* js
var t1 =this ;
circle.addEventListener('mousedown',function(e){
stage.addEventListener('stagemousemove',function(e){
t1.x = stage.mouseX;
t2.y = stage.mouseY;
});
stage.addEventListener('stagemouseup',function(e){
e.target.removeAllEventListeners();
});
});
*/
are you trying to drag and drop circle? if so,
var tl = this;
tl.circle.addEventListener('mousedown', downF)
function downF(e) {
stage.addEventListener('stagemousemove', moveF);
stage.addEventListener('stagemouseup', upF);
};
function upF(e) {
stage.removeAllEventListeners();
}
function moveF(e) {
tl.circle.x = stage.mouseX;
tl.circle.y = stage.mouseY;
}
Copy link to clipboard
Copied
are you trying to drag and drop circle? if so,
var tl = this;
tl.circle.addEventListener('mousedown', downF)
function downF(e) {
stage.addEventListener('stagemousemove', moveF);
stage.addEventListener('stagemouseup', upF);
};
function upF(e) {
stage.removeAllEventListeners();
}
function moveF(e) {
tl.circle.x = stage.mouseX;
tl.circle.y = stage.mouseY;
}