# Flash Speedometer Help

**URL:** <https://forum.kirupa.com/t/flash-speedometer-help/320781>\
**Category:** flash\
**Created:** [April 1, 2011, 9:57am UTC](https://forum.kirupa.com/t/flash-speedometer-help/320781 "2011-04-01T09:57:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![twodanimator](https://avatars.discourse-cdn.com/v4/letter/t/6bbea6/32.png) [@twodanimator](https://forum.kirupa.com/u/twodanimator)\
**Post date:** [April 1, 2011, 9:57am UTC](https://forum.kirupa.com/t/flash-speedometer-help/320781/1 "2011-04-01T09:57:50Z")

</div>

Hi,  
I have done speedometer in flash works fine by entering the value. But my client wants to change the color as pointer moves:

0-20: Dark Green (Very Cheap)  
20-40: Light Green (Cheap)  
40-60: Yellow (Spare Valuation)  
60-80: Orange (Expensive)  
80-100: Dark Red (Very Expensive)

I know value has to be converted into radians/ degrees.

Below is the link which i have created and as2 is below and you can see source file attached! Please help me!!

[http://www.laetuseducation.com/test/](http://www.laetuseducation.com/test/)

import fl.transitions._;  
import fl.transitions.easing._;  
import mx.transitions.Tween;

var control\_btn:Button;  
var my\_btn:Button;  
user.onSetFocus = function() {  
warningTxt.text = “”;  
\_root.instructions.\_visible = true;  
};  
control\_btn.onRelease = function() {  
if (\_root.user.text == “”) {  
\_root.instructions.\_visible = false;  
\_root.warningTxt.text = “Please enter the value”;  
}  
var userNumber:Number = user.text\*1.8;  
var RotateT:Tween = new Tween(my\_btn, “\_rotation”, Strong.easeIn, 0, userNumber, 5, true);  
if ((userNumber\>=0) && (userNumber\<=20)) {  
var colorful1 = new Color("\_root.my\_btn");  
colorful1.setRGB(0x009900);  
} else if ((userNumber\>=21) && (userNumber\<=40)) {  
var colorful2 = new Color("\_root.my\_btn");  
colorful2.setRGB(0x00FF00);  
} else if ((userNumber\>=41) && (userNumber\<=60)) {  
var colorful3 = new Color("\_root.my\_btn");  
colorful3.setRGB(0xFFFF00);  
} else if ((userNumber\>=61) && (userNumber\<=80)) {  
var colorful4 = new Color("\_root.my\_btn");  
colorful4.setRGB(0xFFCC00);  
} else {  
var colorful5 = new Color("\_root.my\_btn");  
colorful5.setRGB(0xFF0000);  
}  
};
