Search Tutorials
Actionscript: frame 1, next Slide functionWe now create a function to go manually through the slides.
//function to go to the next slide.
//k is a global variable here and set to "0" so that first slide
//will be in fact the number for first slide. The number for the first slide
//can be different from 1.
var k = 0;
function nextSlide(firstSlide,lastSlide,slideName,slideText) {
_root.clearEverything();
_root.loadText.gotoAndStop("stop");
percentOutput = "";
//k is incremented by 1 to set to value of next slide.
k = k+1;
//i is the actual slide number.
i = (firstSlide - 1) + k;
//function to load text, when html you can place links
//var newText to load corresponding text into textbox.
newText = (slideText + i + ".txt");
loadVarsText = new loadVars();
loadVarsText.load(newText);
loadVarsText.onLoad = function(success) {
if(success) {
scroller.html = true;
scroller.htmlText = this.myText;
}else{
trace("not loaded");
}
}
// if statements to hide next or previous button
// and to load the pics
if (i == firstSlide) {
_root.leftBut._visible = false;
i = firstSlide;
_root.slideHolder.loadMovie(slideName + i + ".jpg");
_root.newText;
}
if (i == lastSlide) {
_root.rightBut._visible = false;
i = lastSlide;
_root.slideHolder.loadMovie(slideName + i + ".jpg");
_root.newText;
} else if (i !== firstSlide && i !== lastSlide) {
_root.rightBut._visible = true;
_root.leftBut._visible = true;
i = (i+1) -firstSlide;
_root.slideHolder.loadMovie(slideName + i + ".jpg");
_root.newText;
}
}
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||
|