我想在 FLASH 中创建(轮盘赌)纺车模拟。
我想得到一个数字,那个(轮盘赌)纺车将停在指示器前面。
这是演示我实际想要什么的链接。 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++;
}
}
}
这是相同的工作代码。
任何帮助对我来说都很重要。提前致谢。