Skip to main content
tropicanaclock
Known Participant
August 8, 2013
Question

AS3 Change curve to rear of symbol

  • August 8, 2013
  • 1 reply
  • 472 views

I have two draggable objects, and when your drag one them it generates a line based off where your mouse is, and the line is anchored to the other object. What Id like this code to do, is generate the line at the rear of the symbol.

ideas are you could just make an array/statement that finds the current symbol and change the values. But im a little confused on the details. How would I change mouse y and mouse x to the a certain spot on the button

I have this 1st image and I need this 2nd image

 

          if (currentClip == redBtn1  )

          {

currentBtn =redBtn1

          }

       if ((mouseX-targetPointX<0 && mouseY-targetPointY>0) || (mouseX-targetPointX>=0 && mouseY-targetPointY<=0)) {
        line
.moveTo(mouseX-offset,mouseY-offset);
        line
.curveTo(mouseX-offset,targetPointY-offset,targetPointX-offset,targetPointY-offset);
        line
.lineTo(targetPointX+offset,targetPointY+offset);
        line
.curveTo(mouseX+offset,targetPointY+offset,mouseX+offset,mouseY+offset);
   
} else {
        line
.moveTo(mouseX-offset,mouseY+offset);
        line
.curveTo(mouseX-offset,targetPointY+offset,targetPointX-offset,targetPointY+offset);
        line
.lineTo(targetPointX+offset,targetPointY-offset);
        line
.curveTo(mouseX+offset,targetPointY-offset,mouseX+offset,mouseY-offset);
   
}
    line
.endFill();
};

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
August 8, 2013

if the curve goes to the object's reg point (on the left), use the reg pt's y+ object's height instead of the object reg pt y.