PDA

View Full Version : need help with back/forward button


johnny_cat
01-20-2006, 09:33 PM
I'm trying to create previous and next buttons.
I have a MC that slides across the stage. The next button works perfectly, but then the previous gets all screwed up and will jump sections. Any help would be appreciated. or if there is a better way to code this.

this code is on the "next" button

on (release) {
if (mc._x>=0) {
mc.endX = -336;
} else if (mc._x>=-336) {
mc.endX = -673;
} else if (mc._x>=-673) {
mc.endX = -1016;
}
}


this code is on the "previous" button

on (release) {
if (mc._x >= -336) {
mc.endX = 0;
} else if (mc._x >= -673) {
mc.endX = -336;
} else if (mc._x >= -1016) {
mc.endX = -673;
}
}

feanish
01-20-2006, 09:42 PM
Any chance you could post a fla?

johnny_cat
01-20-2006, 10:32 PM
here's the fla.

it works going from 1-4 and then 4-1 but if you click 1-2, then 2-1, then 1-2 again it'll start jumping to 3 or 4 and get all screwed up.

feanish
01-22-2006, 03:10 AM
hmmm... it works just fine for me
I've pushed lots of different combos, and it all worked... ?

I'm using flash 8, but was publishing down to flash 7, so that might have made a difference, but I don't know for sure...

Flash Gordon
01-22-2006, 05:00 AM
nothing works for me in your fla. Where are the buttons to make it change???

smartie_on_computer
01-22-2006, 05:08 AM
the code here: for the prev button
on (release) {
if (mc._x>=0) {
mc.endX = -336;
} else if (mc._x>=-336) {
mc.endX = -673;
} else if (mc._x>=-673) {
mc.endX = -1016;
}
} should be:
on (release) {
if (mc._x<=0) {
mc.endX = -336;
} else if (mc._x<=-336) {
mc.endX = -673;
} else if (mc._x<=-673) {
mc.endX = -1016;
}
}

i reversed the > symble to <

johnny_cat
01-22-2006, 05:58 PM
yeah you'd think that on the previous button to put <= but have you tried it? it didn't work for me. it jumps back to #1 even if I'm on #4. if I put >= it totally works like feanish says if you go through it 1-4 and back 4-1. If you start going from 2-3, then back to 3-2 and keep doing things like that real fast it starts to jump from 2-4 etc...

feanish
01-23-2006, 12:37 AM
nothing works for me in your fla. Where are the buttons to make it change???

you have to change the font... he used helvetica neu, but it had a different spelling than the one on my system, so I saw nothing... weird...