Could this be done? If so, how?

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 :slight_smile:

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

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… :slight_smile:

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 :blush:

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

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]
}

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:

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 :rabbit:

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

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:

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

so you probably want something like…


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

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