A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: help! need to .rotate circle with buttons, change direction

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    4

    Unhappy help! need to .rotate circle with buttons, change direction

    Hi!

    really need some coding for a tricky Actionscipt issue for a Uni assignment...

    what i have is a circle image (for this purpose lets say it looks like a clock). For example: when you click 3 o'clock, the whole clock needs to rotate around with the 3 o'clock btn at the 6 o'clock position (with the pivot point in the centre). each of the 'time' positions (2 o'clock, 3 o'clock, 4 o'clock ...etc) needs to be a button and thus be able to rotate around to the 6 o'clock position.

    This would seem simple enough by just using a .rotate value or using tween movieclips...however the tricky part is:

    the actionscript needs to determine which way the clock turns (anti/clockwise), dependant on where the clicked time-btn's position is. it needs to be some sort of if statement that says:

    if (3'oclock-btn) is positioned between 0 degrees (being original 12'oclock position) and 180 degrees (original 6 o'clock position), then rotate clockwise to the 6 o'clock position. If the (3o'clock btn) is positioned between 180degrees and 259 degrees (12 o'clock position), rotate anti-clockwise to the 6'oclock position.

    im really deserate for this actionscript, my assignment is due in 2 weeks from today, so if anyone knows a solution- i would be forever grateful

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    Im sorry but Im just more confused by your description..

    I have no clue what you mean by all this 6 o'clock position stuff..

    when you click 3 o'clock, the whole clock
    needs to rotate around with the 3 o'clock btn at the 6 o'clock position
    huh?


    Do you want this:

    you have a 'clock face'

    1-12 numbers, just like a clock

    each number is a 'button'

    when you click on any of these numbers.. you want the 'hour hand' movieClip to rotate to that number/position.


    your 'tricky part' is that you want it to take the 'shortest' route to get to that position?


    is this correct?

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    4
    yep, correct in that i need it to get the shortest route, but not the clock hand, the whole clock picture needs to rotate to that position.

    my design is not actually a clock interface, but it was the easiest way to describe the interaction.

    i understand it needs to be an if/or statement, but i dont know how to do the 'shortest route' actionscript

  4. #4
    Registered User
    Join Date
    Oct 2010
    Posts
    4
    attached is an explained example of what the "clock interface" has to do.
    Attached Files Attached Files

  5. #5
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    in that case.. I suggest using the greensock: TWEENMAX tweening class..

    http://www.greensock.com/tweenmax/

    its VERY easy to use (once you do it once or twice)..

    makes tweening a SANP!

    and also does the autoRotate with shortest path for you.



    .............automatically rotate in the shortest direction, plus LOTS more

  6. #6
    Registered User
    Join Date
    Oct 2010
    Posts
    4
    hi,

    this problem has been solved.

    thanks for your actionscripting suggestions.

Tags for this Thread

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