Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8908969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:19:10+00:00 2026-06-15T03:19:10+00:00

I have a dial that rotates 120 degrees clockwise and 120 degrees anti clockwise

  • 0

I have a dial that rotates 120 degrees clockwise and 120 degrees anti clockwise using the rotate TransformGestureEvent.

When rotating this dial I want it to control a movie clip. Dragging through the movieclip as you rotate the dial clockwise then reversing the movieclip when rotating the dial anticlockwise. I want the movieclip to follow the drag of the dial, stopping and starting as and when you drag the dial.

Here is what I have so far but it only seems to turn the movieclip to the last frame then stops?

    import flash.display.MovieClip;
    var dial_mc:MovieClip;
    var knobs_mc:MovieClip;
    var maxRotation:Number = 120;

    var knobFrame:int = knobs_mc.currentFrame;
    var offset:Number = 0;
    var percent:Number = 0;


    knobs_mc.stop();

    Multitouch.inputMode = MultitouchInputMode.GESTURE;

    dial_mc.addEventListener(TransformGestureEvent.GESTURE_ROTATE, rotateDial);

    function rotateDial(e:TransformGestureEvent):void
    {
dial_mc.rotation +=  e.rotation;
if (dial_mc.rotation > maxRotation)
{
    dial_mc.rotation = maxRotation;
}
if (dial_mc.rotation < 0)
{
    dial_mc.rotation = 0;
}
dial_mc.addEventListener(TransformGestureEvent.GESTURE_ROTATE, drag);
offset = e.rotation;
if (e.phase == GesturePhase.END)
{
    knobFrame = knobs_mc.currentFrame;

}


function drag(e:TransformGestureEvent):void
{

    percent =  (e.rotation - offset)/knobs_mc.rotation;

    var frame:int = Math.round(percent * knobs_mc.totalFrames) + knobFrame;

    while (frame > knobs_mc.totalFrames)
    {
        frame -=  knobs_mc.totalFrames;
    }

    while (frame <= 0)
    {
        frame +=  knobs_mc.totalFrames;
    }

    knobs_mc.gotoAndStop(frame);
}
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:19:11+00:00Added an answer on June 15, 2026 at 3:19 am

    You have to adjust your math to map the angles from -120 to 120 to 0 to 240. That way when you try to go to a frame you can get the full range. I’m assuming that frame 1 – 120 have the dial pointing on the left.

    One other approach would be to ditch the frames altogether and work with rotating the dial directly using the angle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dial that I want to rotate 120 degrees clockwise and anti
I have a client that wants to connect to his MySQL database using Dial-up/Modem
So I have this dial image I'm using for a PyQt widget. Right now,
I have a problem with a UIView-subclass object that I am rotating using Core
this is my first question on here. I'm trying to build a dial control
How to do that? I have AnalogClock on my xml. And I want drawable
I have an ASP.NET page that is interacting with a business class. I want
I have a slot machine plugin here that rotates UL's and shows one of
I want to dial-up through VoIP. Yes, I know that it's almost impossible. I
I have a python script that I want to only allow to be running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.