Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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);
}
}
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
@rheaninja: make a habbit of marking a thread "CORRECT" or "HELPFUL" if you are happy with an answer...
Find more inspiration, events, and resources on the new Adobe Community
Explore Now