What's wrong with my script?

well now it traces the value … yay

but it still doesn’t do what i want it to … the movie just sits there

so something about


on (press) {
	floor += 1;
	trace(floor);
	_root.map.gotoAndStop(string(_root.floor));
}

isn’t telling it to go play the frame label with the corresponding number of floor

i took the _root out from in front of floor and now it’s telling it to go to that frame number i have frame labels that are numbers so i can increment the value of floor and it will go to specific frame labels … otherwise i could just do nextFrame(); and prevFrame(); =)

*Originally posted by shuga *
**well now it traces the value … yay

but it still doesn’t do what i want it to … the movie just sits there

so something about


on (press) {
	floor += 1;
	trace(floor);
	_root.map.gotoAndStop(string(_root.floor));
}

isn’t telling it to go play the frame label with the corresponding number of floor **

your missing _root in

floor += 1;
trace(floor);

Hmm, on (press) doesn’t work, but on (release) does.

Try this…

on (release) {
	_root.floor += 1;
	_root.map.gotoAndStop(String(_root.floor));
}

Works great for me.

Any idea why it works with on (release) and not on(press) senocular? I am interested in this one, makes no sense to me.

beta

the script you gave me makes it go to the next frame. i want it to go to the next frame label

they are both numbers but label 2 could be in frame 14 while label 3 is in frame 22 … i want it to go to the next frame label

also i tried to put an if statement before the code since we only have 5 floors. but it doesn’t seem to stop the value from incrementing when i trace it

suggestions?

Erm…

No clue really, I have to go now though.

Hopefully senocular can help you out :slight_smile:

*Originally posted by lostinbeta *
**Any idea why it works with on (release) and not on(press) senocular? I am interested in this one, makes no sense to me. **

actually I should have mentioned this since I should have known it would have been a problem, but…

its because there are actually 2 actions set in the example in the download. One on the movieclip and one on the button. The button is the darker image ot the stairsUp symbol, while the movieclip is the symbol with 16% alpha overlayed. Each have an on(press) action but only one will work since the uppermost button action supercedes any below.

Since the button has the correct hit area (that which is specified in its 4th frame) THAT is the symbol that this script should be attached to, and the button script should be deleted. The button initially had:
on (press) {
_root.nextFrame();
}
on it, which I guess was part of the experimenting of trying to get this to work? Anyway, in the linked example it was there along with the movieclip on(press) which in combination confused each other.

only one of those symbols should have any action, and that should be the button and that would be


on(press){
	map.gotoAndStop(string(++floor));
}

or whatever it was from prior to this you found worked (though this works too)

ok … thanks for all your help beta … have a good time with your g/f =)

LOL, I actually just noticed that two buttons thing.

But the script with String(_root.floor) acts like a nextFrame() action. Any idea why?

Thanks Shuga, good luck with this problem :slight_smile:

thats actually a number thing. Like you cant name instances with a number so is true with frame labels (as gotoAndStop(“1”) is equivelent to gotoAndStop(1))

you should replace the frame labels with something like f1 instead of 1 and f2 instead of 2 etc. Then include that in the goto with “f”+floor

…another thing Ive overlooked lol… Im getting too old for this

lol … i hadn’t noticed the two buttons thing before … lol thanks

it’s still giving me the frame number though … not the frame label.

ok lol … hadn’t seen that last post yet before i replied

i added f1, f2 etc. but how do i add that to the string … i’m a little confused

thank you very much for all your help

i got it … thankyou


on (press) {
	if(_root.floor<5)
	_root.floor += 1;
	_root.map.gotoAndStop(String("f"+_root.floor));
}

SWEET!

Thanks Senocular. I learn something new all the time from you…lol.