# 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:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![shuga](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@shuga](https://forum.kirupa.com/u/shuga)\
**Post date:** [January 15, 2003, 8:14pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/1 "2003-01-15T20:14:17Z")

</div>

i have a variable declared elswhere called floor. when this button is pressed i want 1 to be added to floor and then i want flash to go to the frame label that corresponds to the variable floor

```auto

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

```

thx

---

<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 15, 2003, 8:19pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/2 "2003-01-15T20:19:11Z")

</div>

Well \_root.floor is a number you are declaring not a frame label. You only use double quotes " " on gotoAnds if you are targeting a frame label. So you should do this…

```auto
on(press){
	_root.floor++;
	_root.map.gotoAndStop(_root.floor);
}

```

I changed \_root.floor+=1 to \_root.floor++ because well… it is the same thing ;)…lol.

---

<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 15, 2003, 8:38pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/3 "2003-01-15T20:38:22Z")

</div>

i am targeting a frame label … not a frame number

\_root.floor is a number and that number is a frame label in a movieclip. i made them labels so i could move the actual frame number around.

does that make sense?

---

<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 15, 2003, 8:41pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/4 "2003-01-15T20:41:40Z")

</div>

OHH!!! 'DOH I read it wrong again.

my Apologies.

Alright so in that case…

Since you are going gotoAndStop("\_root.floor") it is looking for the frame label that says \_root.floor. You don’t have that. What you will need to do is this…

gotoAndStop("""+\_root.floor+""");

" is how to add a double quote inside double quotes (I believe that is right) So this will make your final output like this (if \_root.floor outputs 5)…

gotoAndStop(“5”);

---

<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 15, 2003, 8:48pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/5 "2003-01-15T20:48:30Z")

</div>

doesn’t work … what’s with the +'s

here’s the error i get

> 

Scene=main, Layer=buttons, Frame=1: Line 3: ‘)’ or ‘,’ expected  
\_root.map.gotoAndStop(gotoAndStop(“"”+\_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 15, 2003, 8:50pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/6 "2003-01-15T20:50:46Z")

</div>

you put a gotoAndStop inside a gotoAndStop?

I meant to replace the gotoAndStop with the new one… so it will be…

\_root.map.gotoAndStop("""+\_root.floor+""");

The + attaches (old usage used to be “add”) the next thing to the string, so if \_root.floor it would of outputted 5, it would be like this…

" + 5 + "

Combining them to become “5”

---

<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 15, 2003, 8:57pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/7 "2003-01-15T20:57:49Z")

</div>

hahahahahaha … stupid copy/paste error

still doesn’t work though

the file is 2.3mb do you have an email addy where i can send it to you so maybe you can see what i’m trying to do?

---

<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 15, 2003, 9:03pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/8 "2003-01-15T21:03:51Z")

</div>

No, my inbox is almost full, I can’t have that big of a file.

Can you upload it to a server?

I don’t see why it doesn’t work though… in a new document try this…

Paste these actions on Frame 1

```auto
floor = 5;
a = "gotoAndStop("+"\""+_root.floor+"\""+")";
trace(a);

```

It outputs the right syntax.

Maybe I should have testing what I was saying before I gave you the code though :-\

---

<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 15, 2003, 9:04pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/9 "2003-01-15T21:04:02Z")

</div>

actually i uploaded it to a server  
[www.roughedout.com/tour.abc](http://www.roughedout.com/tour.abc)

download and change the extension to fla  
it should work

the button i’m working on is on the buttons layer and it’s the one that looks like stairs with the + above it. i will obviously be doing the - next.

thx

---

<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 15, 2003, 9:14pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/10 "2003-01-15T21:14:02Z")

</div>

also if you are just feeling industrius or otherwise bored you are more than welcome to make suggestions on other parts of this program i’ve been working on for way too long =)

---

<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 15, 2003, 9:17pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/11 "2003-01-15T21:17:13Z")

</div>

Well what I am wondering are two things…

I can’t seem to find any movie clip with the instance name “map”.

I assumed it was the big clip in the middle, but that is a graphic symbol.

Also… why do it by a variable? Why not just use \_root.map.nextFrame() ?

---

<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 15, 2003, 9:19pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/12 "2003-01-15T21:19:15Z")

</div>

Nevermind… got it…lol.

And yes… \_root.map.nextFrame() works.

So for the minus one you cna use \_root.map.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 15, 2003, 9:20pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/13 "2003-01-15T21:20:11Z")

</div>

in the layers there is a folder of layers called map … the symbol is in there … if you look in the library the symbol itself is called mapview.

and i don’t use nextframe b/c there are many other things inside that symbol, all the divisions of the company (selectable through the combobox) so they won’t always be right next to the proper frame.

that button is only to go between floors on the map … not through every frame of the mc. that would take them through all the divisions etc which i want them to select via the combobox

once you open the symbol you should be able to see what i’m talking about

---

<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 15, 2003, 9:25pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/14 "2003-01-15T21:25:33Z")

</div>

LOL… man you gotta be difficult dontcha!.. :beam:

Well I can’t work on it right now, I am about to go soon, and your file keeps crashing my Flash whenever I try to edit something or preview it.

Hopefully someone else will be able to solve it, if not, I will be back on it when I come back later.

---

<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 15, 2003, 9:26pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/15 "2003-01-15T21:26:52Z")

</div>

ok … thanks for the help

someone help me!

:trout: stupid project is whoopin 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:16pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/16 "2003-01-16T18:16:26Z")

</div>

Hey shuga, I can’t work on it today (going to see my girlfriend… YAY), but I found this excellent article at Macromedia that seems like it may fix your problem…

[http://www.macromedia.com/support/flash/ts/documents/flash\_labels\_scripting.htm](http://www.macromedia.com/support/flash/ts/documents/flash_labels_scripting.htm)

Note: Yes, it was written for Flash for, so some syntax needs updating in it, but the basic idea is still there.

---

<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:29pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/17 "2003-01-16T18:29:24Z")

</div>

according to the article

> 

In this example, note the use of quotes to indicate the movie clip’s instance name as a string, to which the variable’s value is concatenated:

Go to and Play (“/theClip:” & theVariable)

my script should read

```auto

on(press){
	floor++;
	trace(floor);
	gotoAndStop("_root.map:"&floor);
}

```

and it might work … i dunno … i don’t think my variable is being detected b/c the trace action doesn’t even work. it does the same thing if i put \_root in front of floor as well

not really sure what’s wrong

---

<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:38pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/18 "2003-01-16T18:38:59Z")

</div>

\_root.map.gotoAndStop(string(\_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 16, 2003, 6:39pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/19 "2003-01-16T18:39:38Z")

</div>

Hmm, odd… ++ is used to increment a variable, but if used here, it doesn’t read the variable at all.

This traces fine

```auto
on (press) {
	floor += 1;
	trace(floor);
	gotoAndStop("_root.map:" & 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:41pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-script/11341/20 "2003-01-16T18:41:21Z")

</div>

Hmm, didn’t know you could do that Senocular… interesting… ;)…lol.

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