Skip to main content
Participant
August 24, 2013
Question

Spinning Wheel

  • August 24, 2013
  • 4 replies
  • 949 views

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.

please help

This topic has been closed for replies.

4 replies

Inspiring
August 28, 2013

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

Ned Murphy
Legend
August 24, 2013

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.

Inspiring
August 24, 2013

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);

     }

}

Inspiring
August 24, 2013

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