# Stupid Quick Question

**URL:** <https://forum.kirupa.com/t/stupid-quick-question/1031>\
**Category:** flash\
**Created:** [August 6, 2002, 8:23pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031 "2002-08-06T20:23:48Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![VixenLady](https://avatars.discourse-cdn.com/v4/letter/v/5daacb/32.png) [@VixenLady](https://forum.kirupa.com/u/VixenLady)\
**Post date:** [August 6, 2002, 8:23pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/1 "2002-08-06T20:23:48Z")

</div>

What is the code I would use to tell a button (instance) to go a scene in a movie?

I was thinking:

officebut.onPress = function () {  
gotoAndPlay(“Scene Office Movie, 1”);  
}

but it didn’t work.

Thanks  
Vixie

---

<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:** [August 6, 2002, 8:33pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/2 "2002-08-06T20:33:48Z")

</div>

One word: \_root.

pom :asian:

---

<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:** [August 6, 2002, 8:36pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/3 "2002-08-06T20:36:39Z")

</div>

officebut.onPress = function () {  
gotoAndPlay(“Office Movie, \_root”);  
}

Augh that didn’t fix it, so guess I didn’t put “\_root” in the right spot eh?

Help,  
Vixie

---

<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:** [August 6, 2002, 8:43pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/4 "2002-08-06T20:43:48Z")

</div>

No you didn’t 😛

You have to wonder, Vixie, who you are telling to gotoAndPlay, and from where (riddle #1).

pom :asian:

---

<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:** [August 6, 2002, 8:51pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/5 "2002-08-06T20:51:33Z")

</div>

officebut.onPress = function () {  
gotoAndPlay(“Office Movie”, \_root);  
}

(fixed a quote issue I think)

Okay to me that code says that I am telling the instance officebut (which happens to be my button) to go and play the scene Office Movie on the root level.

Am I missing it?

Vixie … who is really trying to learn 🙂

---

<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:** [August 6, 2002, 8:52pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/6 "2002-08-06T20:52:39Z")

</div>

officebut.onPress = function () {  
gotoAndPlay(“Office Movie”, \_root);  
}

But wouldn’t “Office Movie” be a label? How do you tell it is a scene verses a label?

Oh now I am so confused.

Vixie … who knows this can’t be THAT complicated

---

<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:** [August 6, 2002, 9:00pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/7 "2002-08-06T21:00:35Z")

</div>

OK, OK. To tell the \_root to play, all you have to do is put \_root. in front of your action. It’s called the dot syntax. You have to tell \_root to play because you’re in the button (although it doesn’t really make sense, but I don’t know how buttons work exactly:)

\_root.gotoAndPlay(“your Scene”,1);

When it’s a label, you don’t put a frame number afterwards.

pom :asian:

---

<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:** [August 6, 2002, 9:03pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/8 "2002-08-06T21:03:07Z")

</div>

Are you applying the AS to a button or to an MC (movie clip)?

Button (insert on Button Actions)

```auto

on (press) {
    gotoAndPlay(1);
}

```

MC (Insert in Frame Actions)

```auto

_root.officebut.onPress = function() {
	gotoAndPlay(1);
};

```

I think that is how it would go. I am new too, so if I am wrong, sorry.

---

<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:** [August 6, 2002, 9:06pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/9 "2002-08-06T21:06:25Z")

</div>

lol … thats why i have never messed with scenes … if my file is too big to do on one timeline then i make a new .swf file and link the two together. LoadMovie seems to work better for me 🙂

but if you are trying to load the scene  
the following code should work

on (press) {  
gotoAndPlay (“Office Movie”, 1);  
}

where Office Movie is the name of the scene and 1 is the frame in the scene that you wish to play on press of the button to which you have attatched this action; in your case officebut.

hope this helps 🙂

the \_root discussion was funny … thx for the laughs … i don’t use \_root often though and my movies usually work … except when in cases of object control STUPID VARIABLE MATH!!!

---

<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:** [August 6, 2002, 9:15pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/10 "2002-08-06T21:15:51Z")

</div>

\>\> lostinbeta: it works. buttons and clips can have dynamic handlers (otherwise, there’s no point giving them names…). And I think that Macromedia kept buttons only for backward compatibility, because they’re really useless now…

\>\> Shuga: Glad it made you laugh, but it wasn’t intented. I was in my ‘Spiritual guide’ break. And you’re right, scenes suck. But what you point out is interesting.

```auto
on (press) {
gotoAndPlay ("Office Movie", 1);
}

```

will work, but not

```auto
officebut.onPress = function() {
	gotoAndPlay("Office Movie", 1);
}

```

won’t. Which means that putting a dynamic event handler makes the code inside it relative to the object. Which is not true for a movie clip.

I’ll have to check on that.

pom :asian:

---

<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:** [August 6, 2002, 9:20pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/11 "2002-08-06T21:20:18Z")

</div>

Very edumactional 🙂

(Yes that was intentionally mispelled, I am not THAT stupid)

---

<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:** [August 6, 2002, 9:23pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/12 "2002-08-06T21:23:44Z")

</div>

pom … i don’t understand the purpose of the

= function() {

can you please explain why one would put that in there instead of just the simple gotoandPlay code?

[update]  
also about the \_root thing:  
\_root is very useful when you are specifying an action on a symbol deep within your movie so you don’t have to back out of directories (i.e. …/…/…/…/instanceName) instead you can just put \_root.instanceName b/c when you are specifying an action for an instance that is in the \_root already … its a bit redundant to tell the computer \_root

---

<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:** [August 6, 2002, 9:34pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/13 "2002-08-06T21:34:15Z")

</div>

I know you can add parameters in between the () in your funtion.

Does that serve the same purpose it does in javascript?

In javascript it would look like this (taken from an earlier img rollover script I wrote)

function imgOn (imgName) {

blah blah blah  
}

then in your link for you rollover it would be  
A HREF="#" onMouseover=“imgOn(imgNameforRollover)”

then when you mouseover the image with the link it will change it to the new image.

The new image was called imgNameforRollover and in the script it is specified as

imgNameforRollover = mynewimage.jpg

so it would replace old.jpg with mynewimage.jpg

Just wondering if its the same purpose.

(if you don’t understand the javascript thing, sorry, I hate explaining things…lol, i’m not very good at it)

---

<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:** [August 6, 2002, 9:35pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/14 "2002-08-06T21:35:54Z")

</div>

Aha!! You’ve not read my last tute! I’ll tell Kirupa.

[http://www.kirupa.com/developer/actionscript/as\_tricks.asp](http://www.kirupa.com/developer/actionscript/as_tricks.asp)

Check the dynamic event handlers.

pom :asian:

---

<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:** [August 6, 2002, 9:36pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/15 "2002-08-06T21:36:58Z")

</div>

officebut.onPress = function() {  
gotoAndPlay(“Office Movie”, 1);  
}

Works but it doesn’t. See it loads a scene, but it is the next scene I have not neccessarily (sp?) the scene named.

So we are getting close 🙂

Vixie

---

<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:** [August 6, 2002, 9:40pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/16 "2002-08-06T21:40:15Z")

</div>

\_root., Vixie, \_root… (read the posts once more 😛 )  
And I’m going to bed, so i hope you’ll make it this time.

pom :asian:

---

<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:** [August 6, 2002, 10:14pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/17 "2002-08-06T22:14:40Z")

</div>

Added \_root and it works 🙂

Weird because I did that before and it didn’t have any effect, but this time it did.

_shrugs_

Ah well as long as it is working, I am a happy little camper,  
Vixie … who thanks you’al for helping=)

---

<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:** [August 6, 2002, 10:54pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/18 "2002-08-06T22:54:54Z")

</div>

Hey lyaslamasse,

I actually didn’t read your tutorial until now, and it explains it GREAT! Im glad you posted that link. I will be checking out all those AS Tricks.

You really are a flash guru!!!

Hey Vixie,

Congrats on getting your button to work!

---

<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:** [August 6, 2002, 11:52pm UTC](https://forum.kirupa.com/t/stupid-quick-question/1031/19 "2002-08-06T23:52:11Z")

</div>

aye lad … lyaslamasse is da bomb flasher !!
