# Could this be done? If so, how?

**URL:** <https://forum.kirupa.com/t/could-this-be-done-if-so-how/63748>\
**Category:** Uncategorized\
**Created:** [September 9, 2004, 6:28pm UTC](https://forum.kirupa.com/t/could-this-be-done-if-so-how/63748 "2004-09-09T18:28:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Azazel](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@Azazel](https://forum.kirupa.com/u/Azazel)\
**Post date:** [September 9, 2004, 6:28pm UTC](https://forum.kirupa.com/t/could-this-be-done-if-so-how/63748/1 "2004-09-09T18:28:58Z")

</div>

i want to make a “check function” on a button…

this is what i got so far

on (release){  
if(\_root.enter.level1.showgallery\_mc.\_currentframe == 10){  
\_root.enter.level1.showgallery\_mc.gotoAndPlay(“10”)[COLOR=Red] then go to and play \_root.gotoAndPlay(“19”); (this is the part i don’t know how to write in AS. I want it to say "if executed on this button go to frame 19 in root efter having played frames from frame 10. Because i want diffrent buttons to go back to a diffrent frame in the root timeline so i can’t just ad the gotoAndPlay(“19”) at the end of the first animation.)[/COLOR]  
}else{  
\_root.enter.level1.gotoAndPlay(“19”);  
}  
}

If you don’t understand (cause it’s a bit meassy…) just post what i’m not making clear enough 🙂

otherwise… any thoughts anyone? :ear:  
**[SIZE=3]  
[COLOR=Red]THIS HAS CHANGED SOMEWHAT… PLEAS FOLLOW THE THREAD FOR UPDATES[/COLOR][/SIZE]**

---

<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:** [September 9, 2004, 6:47pm UTC](https://forum.kirupa.com/t/could-this-be-done-if-so-how/63748/2 "2004-09-09T18:47:29Z")

</div>

You have to use: gotoAndStop(10) ; (without the "quote thingy’s) . I don’t think it will work when you use gotoAndStop(“10”) …

And try not to put you explenation IN your code… 🙂

---

<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:** [September 9, 2004, 7:14pm UTC](https://forum.kirupa.com/t/could-this-be-done-if-so-how/63748/3 "2004-09-09T19:14:51Z")

</div>

hehe, sorry about the xplenation in code… but that realy didn’t help much :h: what i want is to tell flash that if i push the contact button and if the gallery is open, first close the gallery, after having played the frames in the galley clip gotoAndPlay frame 19 on the root timeline, but if i hit the guestbook btn, close the galler, but the gotoAndPlay frame 20 in the root timeline and so on for all the other btns… hope i gave a better explenation this time 😊

this is what i got now

on (release){  
if(\_root.enter.level1.showgallery\_mc.\_currentframe == 10){  
\_root.enter.level1.showgallery\_mc.gotoAndPlay(“10”);  
}else if(\_root.enter.level1.\_currentframe == 25){  
stop();  
}else{  
\_root.enter.level1.gotoAndPlay(“19”);  
}  
}  
and it works, only when it finnished playing in the showgallery\_mc it goes to and stop at frame 18 in root timeline, because i dont know how to specify which frame it should go to deppending on what btn was hit

---

<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:** [September 10, 2004, 3:08pm UTC](https://forum.kirupa.com/t/could-this-be-done-if-so-how/63748/4 "2004-09-10T15:08:29Z")

</div>

make this a function and call it from the button and pass in a param to tell who is calling it.  
example -  
(i made this function on the root timeline in the example)  
function doAction(action:String):Boolean{  
[indent]//return value ‘optional of course’  
var completed:Boolean = false  
switch case(action.toLowerCase()){  
[indent]case “contact”:  
[indent]//code to execute if contact was pressed  
//set the return to true - this way you can  
//add condionals based on if this runs  
completed = true  
[/indent]break’;  
case “guestbook”:  
[indent]//code to execute if guestbook was pressed  
completed = true  
[/indent]break;

[/indent]}

return completed  
[/indent]}

on your buttons - (im assuming these are nested in a clip somewhere)

on(release){  
[indent]//change to guestbook for guestbook button  
\_root.doAction(“contact”)

//OR  
//if you want to make it conditional (you want it  
//to do the function first, then do something else…)

if(\_root.doAction(“contact”){  
[indent]//additional code here  
[/indent]}else{  
[indent]//that did nothing  
trace(“function call failed”)  
[/indent]}  
[/indent]  
}

---

<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:** [September 10, 2004, 3:20pm UTC](https://forum.kirupa.com/t/could-this-be-done-if-so-how/63748/5 "2004-09-10T15:20:52Z")

</div>

ok, haven’t got time right now to test this… put it looks like it should work… THX :azn:

I’ll post later how it went! :sen:

---

<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:** [September 14, 2004, 3:10am UTC](https://forum.kirupa.com/t/could-this-be-done-if-so-how/63748/6 "2004-09-14T03:10:42Z")

</div>

OK, tried it today… but i get this

**Error** Symbol=motion\_mc, layer=content, frame=1:Line 4: ‘(’ expected  
switch case(action.toLowerCase()){

?!? :h:

I’m not realy the AS masta i wanna be 🐇

The buttons are in the same mc as the layer where the AS is… :kir:

---

<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:** [September 14, 2004, 3:32am UTC](https://forum.kirupa.com/t/could-this-be-done-if-so-how/63748/7 "2004-09-14T03:32:56Z")

</div>

> [@Azazel](#):
>
> OK, tried it today… but i get this
> 
> **Error** Symbol=motion\_mc, layer=content, frame=1:Line 4: ‘(’ expected  
> switch case(action.toLowerCase()){

This isn’t really related to your original problem, but it looks like the syntax of the switch statement is wrong. As Macromedia’s dictionary describes switch, its syntax should follow:

```auto
 switch ([color=#666666]expression){[/color] 
	 [color=#666666]caseClause[/color] :
	[[color=#666666]defaultClause[/color] :]
}

```

so you probably want something like…

```auto

switch (action.toLowerCase())
{
	 case /*value 0*/:
		 //do something
	 //...and so on...
}

```

---

<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:** [September 14, 2004, 3:44am UTC](https://forum.kirupa.com/t/could-this-be-done-if-so-how/63748/8 "2004-09-14T03:44:12Z")

</div>

> [@kbuff](#):
>
> This isn’t really related to your original problem

super :puzzled: … could you (or anybody else) help me?

the problem is still the same… I would like it work so that when i press the (for example) contact btn it plays the frames that closes the gallery or guestbook first if there open, and then plays the frames for opening the contact form.

i’m attaching the fla in a zip… MX 2004.

\_root.enter.level1.motion \<\< this is where it’s all @ in the fla
