dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: using button to rotate object given amount per click

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Posts
    3

    using button to rotate object given amount per click

    sorry, I'm really new to flash, I hack my way through it by building things up on the timeline and spending way too much time probably.

    Anyway, I want to know if there is a relatively easy way to assign like a rotation amount to a button so that each time you click the button it rotates a given object by a certain amount. like, if i can somehow link a circle to the button so eack time the button is pressed it spins the circle by like 15 degrees...is that possible?

    thanks in advance

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    Code:
    // on stage
    // movieclip - instance name - circle
    // button - instance name - btn
    
    btn.onRelease = function(){
    circle._rotation += 15;
    }
    hth

  3. #3
    Junior Member
    Join Date
    Apr 2007
    Posts
    3
    great, thanks!

    this is very stupid i know, but how to i move the point of rotation of the object in the movie clip. right now it is rotating around the top left corner, but since its a circle, i'd like it to spin around the center point of the circle.
    Last edited by RVA333; 04-14-2007 at 06:53 PM.

  4. #4
    Flasher
    Join Date
    Jun 2005
    Posts
    1,365
    Select the transform tool and click on your circle. You should see a white dot in the upper left (most likely) of your circle. Move it to the center, and test your movie.

    ~Sportzguy933

  5. #5
    Junior Member
    Join Date
    Apr 2007
    Posts
    3
    haha ya, i was trigger happy about my post earlier. i figured it out whgen i thought about it for a couple seconds. thanks though.

  6. #6
    Flasher
    Join Date
    Jun 2005
    Posts
    1,365
    No problem ;-)!

    ~Sportzguy933

  7. #7
    Amazed and Amused Mazoonist's Avatar
    Join Date
    Mar 2006
    Location
    Northern California
    Posts
    201
    Sorry, but that's not exactly right. The little white dot you see when you use the free transform tool sets the rotation point for a motion tween for that object. But actionscript uses the registration point of the movie clip as the point of rotation. To change the registration point of an existing movie clip to the center, double click the symbol to edit it. Select all it's graphics, then use the align panel with the "to stage" button pressed, and click the "center horizontal" and "center vertical" buttons.

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