11-30-2009, 01:26 PM
|
#1
|
|
|
problem with if statment
i have a slideshow what basicaly goes thru 5 pictures
but the if statment is not working correctly an i cannot find out why could you please help?
my code
Code:
stop();
next_btn.onRelease = function() {
if (_root._currentframe == 997){
gotoAndStop(992);
}
else {
nextFrame();
}
}
back_btn.onRelease = function() {
if (_root._currentframe == 992){
gotoAndStop(997);
}
else {
prevFrame();
}
}
the back_btn works correctly and goes to the last fra,e where the last picture in the slidshow is but the next button keeps on taking me to frame 1
thankyou in advanced
P.S i can upload the file if you wish to see it
Beattie282
|
|
|
11-30-2009, 01:41 PM
|
#2
|

 |
Halley Research Station,
Latitude 75°35' S,
Longitude 26°39' W,
Brunt Ice Shelf,
Coats Land,
Antarctica |
|
 |
4,161 |
|
|
At a quick glance, there's no reason why that code alone wouldn't cycle through frames 992-997 and then return to frame 992. So it's possible that there's some additional code on frames 1-991 that is interfering with the next_btn, or you're using scenes which has messed up the frame numbering.
__________________
©2006 GlosRFC - Searching 8,168,684,336 brain cells
|
|
|
11-30-2009, 02:18 PM
|
#3
|
|
|
Quote:
Originally Posted by glosrfc
At a quick glance, there's no reason why that code alone wouldn't cycle through frames 992-997 and then return to frame 992. So it's possible that there's some additional code on frames 1-991 that is interfering with the next_btn, or you're using scenes which has messed up the frame numbering.
|
yea i am using scenes but i got the frame numbers from this function to display into the dynamic text feild
Code:
onEnterFrame=function(){
_root.displayNumber=_root._currentframe;
}
this is where i found my frame numbers from ive also tryed all the close numbers like 99"6/8/9" but nothing happens
p.s:
i would not of used scenes if i knew how much hassle they are i only found out today that i had to lable frames to jump around scenes because of the way flash compliles the whole file as one so therfore only one timeline.
thankyou for you help by the way mate 
|
|
|
11-30-2009, 03:29 PM
|
#4
|

 |
Halley Research Station,
Latitude 75°35' S,
Longitude 26°39' W,
Brunt Ice Shelf,
Coats Land,
Antarctica |
|
 |
4,161 |
|
|
One of the drawbacks to using scenes is that it messes up the numbering of your frames. Unfortunately, there's no corresponding _currentlabel in AS2
What you can try doing though is to give frames 992 and 997 a label, e.g. "start" and "end"
Then, on each of those frames place a variable:
on frame 992 put thisLabel = "start";
on frame 997 put thisLabel = "end";
Then change your code to this:
ActionScript Code:
next_btn.onRelease = function() { if (thisLabel == "end"){ gotoAndStop("start"); } else { nextFrame(); } }
back_btn.onRelease = function() { if (thisLabel == "start"){ gotoAndStop("end"); } else { prevFrame(); } }
__________________
©2006 GlosRFC - Searching 8,168,684,336 brain cells
|
|
|
12-01-2009, 10:53 AM
|
#6
|

 |
Halley Research Station,
Latitude 75°35' S,
Longitude 26°39' W,
Brunt Ice Shelf,
Coats Land,
Antarctica |
|
 |
4,161 |
|
|
You should already have a keyframe on frame 992. In the Actions panel, put:
var thisLabel = "start";
You should see the a symbol appear in this frame on the Timeline which shows that you have actionscript located there.
Do the same thing for frame 997
__________________
©2006 GlosRFC - Searching 8,168,684,336 brain cells
|
|
|
12-01-2009, 11:16 AM
|
#8
|

 |
Halley Research Station,
Latitude 75°35' S,
Longitude 26°39' W,
Brunt Ice Shelf,
Coats Land,
Antarctica |
|
 |
4,161 |
|
|
No problem. One thing's for sure...you probably won't be using scenes again 
__________________
©2006 GlosRFC - Searching 8,168,684,336 brain cells
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 06:29 PM.
|
|