-
Using i to go to previous slides
I have several swfs generated by iWork's keynote. I decompiled one to find that first frame is blank. Second frame is labeled "SlideFrame_1"; Fifth is "SlideFrame_2"; and Eighth is "SlideFrame_3". In otherwords every 3rd frame is labeled "SlideFrame_i".
My next button can traverse this just fine but previous button with prevFrame, for obvious reasons above (which weren't so obvious the past 2 days), is having issues going back a frame and showing something new!
I want to make my previousbutton go back to those slide labels in the external swf. Here's the glitch, though, I don't know how many slides are in each swf.
Does anyone have any idea how to get
Code:
previousbtn.onRelease=function(){
gotoAndStop("SlideFrame_"+"i");
}
to actually work? I'm guessing I need some sort of way to increase and decrease i but as of this moment I'm clueless! Any help is greatly appreciated!
xposted in actionscript.org>actionscript 2 and actionscript.org>simplestuff
-
Funkalicious
(this actually should be in the Actionscript section)
If the frames are labeled like that, you Can get to know the amount of slides.
Code:
var Slides:Number = 0
var LastSlide:Boolean = false //A variable that tells the loop if the last slide is found
var i:Number = 2 //Because the first frame containing a slide is frame 2, so we're starting there
// a while loop that will keep running until we tell it that we found the last slide
while(LastSlide == false) {
!!!.gotoAndStop(i)//set it at the frame to check for a slide
if (??? !== undefined) {
Slides++
}
i+=3//set the next frame to check which should be 3 frames ahead)
}
// !!! should be the location where the slides are located (probably _root)
// ??? should be the adress of the slide on that frame. I wouldn't know what iWork's keynote uses, but I guess it's something like _root["Slide"+i] (with i bieng the number of the slide)
Knowing that, you know when there actually is a previous or next slide to go to, so you can write the codes for your buttons.
Code:
//your previous button code
on(press) {
// check if it is the first slide
if (CurrentI !== 0) {
//there IS a previous slide!
CurrentI--
!!!.gotoAndStop((CurrentI*3)+2)
}
}
//your next button code
on(press) {
// check if it is the last slide
if (CurrentI !== Slides) {
//there IS a nexts slide!
CurrentI++
!!!.gotoAndStop((CurrentI*3)+2)
}
}
This still needs some work of your own, but this should give you a good idea what you're looking for. Happy coding
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
|