• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 337
  • Last Modified:

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???
0
894359
Asked:
894359
  • 2
1 Solution
 
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now