• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

equivalent createjs codesnippent of flash as3 drag and drop code snippet

Contributor ,
Feb 12, 2016 Feb 12, 2016

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();

});

});

*/

TOPICS
ActionScript

Views

401

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 12, 2016 Feb 12, 2016

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;

}

Votes

Translate

Translate
Community Expert ,
Feb 12, 2016 Feb 12, 2016

Copy link to clipboard

Copied

LATEST

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;

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines