A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: simple question:a controled mouse drag

  1. #1
    Senior Member
    Join Date
    Jun 2006
    Posts
    100

    simple question:a controled mouse drag

    New to actionscripting.
    I would like to have a knob rotate to the right on a mouse click and drag and have it stop at the "on" position then beable to drag it to two more position then back to the beginning.
    If you can give me some ideas of what kind of scripting I need that will help.
    Thanks!

  2. #2
    Senior Member
    Join Date
    Aug 2001
    Location
    new york
    Posts
    205
    I'm sure there are many ways to tackle this, but here's how I'd solve this:
    1. find out if the button (knob) is pressed: use onMouseDown event
    2. if it's pressed, find out if the cursor is moving(drag): nest onMouseMove event inside 1
    3. if 1&2 are true, then you need to figure out the direction of the mouse. Here's a good tutorial for that: http://www.kirupa.com/developer/acti..._direction.htm
    4. change the rotation of the knob based on the mouse direction.
    5. then compare the knob rotation with the preset value of its rotation if it's on the "on" position.

    if these steps work, I'm sure you can easily apply it to the rest.

    good luck

  3. #3
    Senior Member
    Join Date
    Jun 2006
    Posts
    100
    Thank you for your reply!
    I half understood what you said, I'm learning this from a book.
    I understood 1. I've designed two movies for the knob one were its a whole unit and the unit can be turned. The other is where the little white line can be moved. I'm not sure which would be better to use.
    I tried attaching a MCknob _rotation + = 20 ;but the whole button moves from where it suppose to be. it drops south on me.
    I don't know the coding to put on the button;
    on (press)
    drag MCknob (button/or little white line) to the on position then to the off and dim positions. Then back to the start. while being pressed and if they remove the press they can start where they left off...

    while keeping the whole mc in its place not the whole clip move down while turning. I want the movie clip of the control knob to act like someone turning a radio knob. Maybe I just not know enough to do what I'm wanting from it.
    an example of the coding needed would help.

  4. #4
    Senior Member
    Join Date
    Jun 2006
    Posts
    100
    Oh ya, one of the movie clip mcknob2 has a tween on it for the white line to move to the 4 positions and stop at each on press, but after the first click I can not get it to move to the other positions. Is there a way to get it to responed to multiable mouse presses?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center