4 Replies Latest reply on Aug 28, 2013 4:55 AM by Ron Colmen

# Spinning Wheel

hi

i need some help with a spinning wheel i have made.

at the moment when i click spin it spins on to a number eg 1 and then it stops. and i can click spin again and it will go to another number like 2

i would like to know how to make so that whe it lands on any number but in this case 1 it will go to another scene or frame and play.

this is some of the code i have got

if(_level0.turn == 1){

stop();

}

this code is on all the numbers.

• ###### 1. Re: Spinning Wheel

Not sue if I understood your question correctly. try this

if(_level0.turn == 1){

gotoAndPlay(5); //change this number to the frame number you need to be able to jump.

}

With this you will be able to goto any position wihtin the timeline in the current scene. Also you can try replacing gotoAndPlay with gotoAndStop

• ###### 2. Re: Spinning Wheel

I also find the question incoherent, however as Ron above says, you could use:

gotoAndStop(5); where you replace 5 with the frame number, obviously ..Stop(5) stops on that frame and ..Play(5) goes to frame 5 and then plays to 6 and so on.

How many numbers are there on the wheel? A more efficient way of writing the code would be to use a loops and use that if statement within it, where the number (e.g. == 1 is the iteration count within that loops, e.g. == iteration), something like this:

var totalNumbers:Number = 16;//change this number to how many numbers there are

for(i=0;i<totalNumbers-1;i++){

if(_level0.turn == i){

gotoAndStop(i);

}

}

• ###### 3. Re: Spinning Wheel

How is the the spinning wheel designed?  Since you the code is on all the numbers it is possible you only need to use gotoAndStop(#), where # is defined by the number of the wheel.  But it all depends on how you designed the wheel.

• ###### 4. Re: Spinning Wheel

@rheaninja: make a habbit of marking a thread "CORRECT" or "HELPFUL" if you are happy with an answer...