# What's wrong with my script?

**URL:** <https://forum.kirupa.com/t/whats-wrong-with-my-script/11341>\
**Category:** Uncategorized\
**Created:** [January 15, 2003, 8:14pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341 "2003-01-15T20:14:17Z")\
**Posts on this page:** 14\
**Page:** 2

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 6:43pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/21 "2003-01-16T18:43:44Z")

</div>

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

```auto

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 6:48pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/22 "2003-01-16T18:48:36Z")

</div>

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(); =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 6:50pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/23 "2003-01-16T18:50:12Z")

</div>

> \*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

```auto

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);

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 6:50pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/24 "2003-01-16T18:50:25Z")

</div>

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

Try this…

```auto
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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 6:54pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/25 "2003-01-16T18:54:34Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 7:09pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/26 "2003-01-16T19:09:11Z")

</div>

Erm…

No clue really, I have to go now though.

Hopefully senocular can help you out 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 7:11pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/27 "2003-01-16T19:11:20Z")

</div>

> \*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

```auto

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

```

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 7:11pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/28 "2003-01-16T19:11:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 7:12pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/29 "2003-01-16T19:12:54Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 7:39pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/30 "2003-01-16T19:39:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 7:45pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/31 "2003-01-16T19:45:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 7:48pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/32 "2003-01-16T19:48:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 7:55pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/33 "2003-01-16T19:55:06Z")

</div>

i got it … thankyou

```auto

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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 17, 2003, 3:26am UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/34 "2003-01-17T03:26:14Z")

</div>

SWEET!

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

[Previous page](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341.md?page=1)
