I want to create (roulette) spinning wheel simulation in FLASH.
I want to get a number, where that (roulette) spinning wheel will stop in front of an indicator.
Here is link which demonstrate what I want actually. http://zytwebdev.zoomyourtraffic.in/amol_zytwebdev/roullete/R1_wheel2.swf
section = new Array();
section[0] = "1";
section[1] = "2";
section[2] = "3";
section[3] = "4";
section[4] = "5";
section[5] = "6";
section[6] = "7";
section[7] = "8";
section[8] = "9";
section[9] = "10";
section[10]= "11";
section[11]= "12";
section[12]= "13";
section[13]= "14";
section[14]= "15";
rotate = 0;
//button press
button.onPress = function()
{
spinWheel();
}
//create a function to speed the wheel, slow it down, stop then display result
function spinWheel()
{
speed = 10; //the speed the wheel rotates
count = 0;
button.enabled = false; //while the wheel is spinning disable the button
limit = random(40)+10; //random time for the wheel to spin before slowing down
onEnterFrame = function()
{
rotate += speed;
degrees = rotate; // DEBUG print the rotation
//trace(degrees+" Deg");
if (rotate>359)
{
rotate = rotate - 360;
}
//slow the wheel down
if (count>limit)
{
if (speed>0)
{
speed -= 1.3
}
else
{
//stop the wheel
speed = 0;
onEnterFrame = false;
button.enabled = true; //enable the button
prize = section[Math.floor(rotate/24)] ; //display the result
printsection = Math.floor(rotate/24); // DEBUG print the section number
trace(prize);
}
}
//move wheel if speed is greater than 0
if (speed>0){
wheelHolder.wheel._rotation = rotate;
count++;
}
}
}
And Here is working code for same.
Any help will be important for me. Thanks in advance.