Solved

Track mouse position and adjust circle accordingly

Posted on 2004-10-21
335 Views
Last Modified: 2006-11-17
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
Question by:894359
    2 Comments
     
    LVL 4

    Accepted Solution

    by:
    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
     
    LVL 4

    Expert Comment

    by:Drakkon
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
    I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
    The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
    The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

    934 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now