# Slower and faster buttons for Rotation

**URL:** <https://forum.kirupa.com/t/slower-and-faster-buttons-for-rotation/316606>\
**Category:** Uncategorized\
**Created:** [November 27, 2010, 7:46am UTC](https://forum.kirupa.com/t/slower-and-faster-buttons-for-rotation/316606 "2010-11-27T07:46:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anhpham](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@anhpham](https://forum.kirupa.com/u/anhpham)\
**Post date:** [November 27, 2010, 7:46am UTC](https://forum.kirupa.com/t/slower-and-faster-buttons-for-rotation/316606/1 "2010-11-27T07:46:01Z")

</div>

Hi people.

Im trying to write the codes for buttons that make a Square rotate faster and slower. I tried hard but it did not work. Any help, appriciated, thanks. ![](http://forum.kirupa.com/uploads/kirupa/798/c985a958819d8917.gif)

how about a slider to control speed of the square\_mc. can some1 give me the code. thanks

this is the code:

addEventListener(Event.ENTER\_FRAME, startRotate);

function startRotate(evt:Event):void {  
// Call function rotateSquare  
rotateSquare();  
}

function rotateSquare():void {  
// Rotate the MovieClip  
square\_mc.rotation += 3;  
output\_txt.text = "Current rotation angle: " + square\_mc.rotation;}

slower\_btn.addEventListener(MouseEvent.MOUSE\_DOWN, slower);

function slower(evt:MouseEvent):void {  
square\_mc.speed -=1;  
}

faster\_btn.addEventListener(MouseEvent.MOUSE\_DOWN, faster);

function faster(evt:MouseEvent):void {  
square\_mc.speed +=1;  
}  
 ![](http://forum.kirupa.com/uploads/kirupa/615/b7e0d890f190c4d7.gif) [![](http://forum.kirupa.com/uploads/kirupa/5523/bbd281b1914a8706.gif)](http://www.actionscript.org/forums/report.php3?p=1042247) ![](http://forum.kirupa.com/uploads/kirupa/5477/b4dcc1ee527db6cd.gif)
