Skip to main content
Inspiring
February 13, 2016
Answered

equivalent createjs code for as3 hitTestObject

  • February 13, 2016
  • 1 reply
  • 1833 views

i have two objects circle_mc  and square_mc


if (circle_mc.hitTestObject(square_mc))
{
  trace("Collision detected!");

}

what is the equivalent createjs code

This topic has been closed for replies.

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
February 13, 2016
Inspiring
February 14, 2016

it for bitmap .

i am exporting form flash movieclip

/* js

// to drag circle

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;

}

// to drag rect

var t2 = this;

t2.rect.addEventListener('mousedown', downFr)

function downFr(e) {

stage.addEventListener('stagemousemove', moveFr);

stage.addEventListener('stagemouseup', upFr);

};

function upFr(e) {

stage.removeAllEventListeners();

}

function moveFr(e) {

t2.rect.x = stage.mouseX;

t2.rect.y = stage.mouseY;

}

// to make them collide and circle opacity will be 0.1

var intersection = ndgmr.checkRectCollision(rect,circle);

if (intersection)

{

  circle.alpha=0.1;

}

*/

Inspiring
February 14, 2016

dear sir

moreover checkRectCollision is not createjs methos . its another .js

col = ndgmr.checkRectCollision(this,collObjs);

there is also nothing named ndgmr .