Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why is this script not working?

Status
Not open for further replies.

bazmanblue

Programmer
Sep 20, 2006
13
GB
Im trying to use this code with buttons to do a slide show in flash. I have copied it exactly the same from a tutoring dvd but comes up with the following error when clicking the previouse slide button

Error opening URL "file:///C|/Documents%20and%20Settings/barry%20%20walker/My%20Documents/myportfolio/frames/framesNaN.jpg"

and when clicking the next slide button it shows the same clip.

here is the script i am trying to use

var slideInfoLV:LoadVars = new LoadVars();
slideInfoLV.load("vars/slide_info.txt");


var curFrameNum:Number = 0;

function loadFrame() {
_level0.myMCL.loadClip("frames/frames" + curFrameNum + ".jpg", this.framesMC);
}
loadFrame();

//--------------<nextslidebutton>-------------//
this.nextSlideBtn.onRelease = function() {
if(curFrameNum < Number(slideInfoLV.totalFrames) -1) {
curFrameNum++;
} else {
curFrameNum = 0;
}
loadFrame();
}

//--------------</nextslidebutton>-------------//

//--------------<prevslidebutton>-------------//
this.prevSlideBtn.onRelease = function() {
if(curFrameNum == 0) {
curFrameNum = Number(slideInfoLV.totalFrames) - 1
} else {
curFrameNum --;
}
loadFrame();
}

//--------------</prevslidebutton>-------------//



i would be helpful for any help
thanks
baz

 
it looks like your out of bounds some where, place this in for debugging

//--------------<prevslidebutton>-------------//
this.prevSlideBtn.onRelease = function() {
trace(curFrameNum); /*THIS NEW LINE*/
if(curFrameNum == 0) {
curFrameNum = Number(slideInfoLV.totalFrames) - 1
} else {
curFrameNum --;
}
loadFrame();
}


I think whats going on is you start on frame 1 hit previous and get frame 0 which doesnt exist.

what do you get for the trace?
 
yes i have a frames0.jpg to frames9.jpeg
is the way i have been told to do it by a lynda.com video wich ive checked over 5 or 6 times now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top