-
simple "go next" action script?
I am trying to create a simple slide show, i have set up the different slides with labels and i want one button to go to the next slide and one to go to the pervious.
It seems simple but i cant seem to find a code that works.
something like...
on release go to and play "next"
there are too many slides to put in the individual name of each label. so a simple next button would be ideal.
any ideas?
-
FK'n_dog
are you moving the playhead along a timeline ?
if so, use -
nextFrame(); // goes to the next frame and stops
prevFrame(); // goes to the previous frame and stops
ActionScript 2.0 Language Reference >
ActionScript language elements > Global Functions > nextFrame function
an example of controlling the timeline with keypresses is shown here.
hth
-
hi thanks for ur reply. I need the playhead to go to a specific label because not all labels are the same number of frames apart. its just a simple slide show, but some of the slides need to run for more frames than others, therefore if i could get the playhead to jump to the next label that would be ideal. there are too many to type in individually the label name.
any ideas?
-
FK'n_dog
if you are going to navigate by labels, at some point you are going to have to
bite the bullet and make a list of all of the labels in use
prolly easiest to use an array and a variable
arrLabels = ["label1", "label2","label3"......]; // array of labels
var id =0; // variable
next_btn.onRelease = function(){
id <= arrLabels.length ? id++ : null; // don't go past last label in array
gotoAndPlay(arrLabels[id]);
}
prev_btn.onRelease = function(){
id > 0 ? id--: null ; // don't go past first label in array
gotoAndPlay(arrLabels[id]);
}
-
im a beginner so thats looks really complicated to me. if you have a spare minute can u explain it a bit more. thanks a lot!!!!
-
FK'n_dog
variable id starts at zero - id=0;
next button has id++, this is id = id+1, so id=1;
in the array - arrLabels[1] = "label2"
so the button release sends the timeline to "label2"
previous button has id--, this is id = id-1, so if id was 5, it becomes 4
in the array - arrLabels[4] = "label5"
so the button release sends the timeline to "label5"
the ternary operators < ? : > are used to prevent the variable id
going outside of the limits of the array
any help
-
-
FK'n_dog
you're welcome
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|