Track mouse position and adjust circle accordingly

I have a circle (movie clip) in the upper left corner of my flash. I want to have that circle expand the closer the mouse gets to it or contract the farther it moves away from any entry point in the piece. How would I do this???
894359Asked:
Who is Participating?
 
DrakkonCommented:
var baseWidth = circle._width;
var baseHeight = circle._height;

function resizeCircle() {
      var currDist = Math.sqrt(Math.pow((circle._xmouse),2) + Math.pow((circle._ymouse),2));
      // can modify here to grow bigger with a grow factor */
circle._width = baseWidth+ currDist;
      circle._height = baseHeight + currDist;
}

setInterval(resizeCircle,10);
0
 
DrakkonCommented:
oops wasnt done yet...anyways use that code on first frame...circle is just your circle's movieclip name you can multiply or divide currDist to get it to grow/shrink at a rate you need
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.