PDA

View Full Version : goto depending on the var:


tiger
10-17-2002, 08:53 PM
my page has multiple buttons, when I select one a short video runs removeing things from the screen prparing or the new stuff to come in. no matter what button I press the same video is going to play. my problem is after the video plays I i want it to goto the specified frame. I tried seting up the buttons to give the var:name a diffrent value (ie: "goo") depending on which you push. that works. but I can get i to goto the specified frame depending on the var: any ideas or another way of doing it?

EDIT: hers what i was using, dont laugh TOO hard im new

if (var:name = goo) {
gotoAndPlay(37);
}

spazmaster
10-17-2002, 10:38 PM
make labels in the movieclip you are targeting.
give the label name same as the var name


gotoAndPlay("goo");

tiger
10-17-2002, 11:21 PM
great thanks!

tiger
10-17-2002, 11:52 PM
its still not working Im using

if (var:name = goo) {
gotoAndPlay("goo");
}

do you see a problem with my spacing? am I right to use the equal sign?

Im stumped. mabey the problem is with my var: I have it setup to display it on the screen so I know that the var: goo is being established

tiger
10-18-2002, 12:19 AM
ok I now think I know what the problem is. the goto part works gret (thanks spazmaster). I know this because I took out the IF statment and it went right there. therefore the problem is with my variables. My when I select the button the variable value name ie: goo appears in the dynamic text box that i set up. but the problem I believe is that when my IF statement

if (var:name = ang) {
gotoAndPlay("ang");
}

dose not see the value goo becase all my variable does is display the value goo. so now if you can make sense of what i jst typed pls help

spazmaster
10-18-2002, 12:05 PM
try


if (var:name == ang) {
gotoAndPlay("ang");
}

tiger
10-18-2002, 04:10 PM
wow great thanks! :) I worked on that for hours yesterday and could not figure it out. all I needed was the extra = sign :) I dont understand what the second equal sign does but I will never forget now ;) thanks again

tiger
10-18-2002, 04:42 PM
ok that worked great but when ! tried to put a scond one in

if (var:name == goo) {
gotoAndPlay("goo");
}
if (var:name == ang) {
gotoAndPlay("ang");
}

it will always take me to "ang" when i took out the statement

if (var:name == ang) {
gotoAndPlay("ang");
}
it goes to "goo" like it should but it will only take you to one if there both there, any ideas?

EDIT: I have alo tried this and get the the same results

if (var:name == goo) {
gotoAndPlay("goo");
if (var:name == ang) {
gotoAndPlay("ang");
}
}

pom
10-19-2002, 12:34 AM
:confused: What is this syntax??? if (var:name = ang)
What is the : doing here exactly?

pom :eek:

jimburton
10-19-2002, 01:14 AM
also, you should be able to just say

gotoAndPlay(name)

if *name* (which is not a great name for a variable) will equate to a frame label

spazmaster
10-19-2002, 04:45 PM
hehe i just thought var:name = was another syntax i didnt know...so it is non-existant?

jimburton
10-19-2002, 07:44 PM
nope, it has no meaning at all that I know of...altho the colon was an operator in flash 4 days of yore...

spazmaster
10-20-2002, 01:03 PM
well to help out tiger, this is what you should have used:

movieClip._variable == goo


where movieClip is the instance name of your movieclip.
but that wouldnt get you where you want.

best would be if you have Flash MX:

//put this actionscript on frame 1
movieClip.onPress = function (){
gotoAndPlay(this._variable);
}

tiger
10-20-2002, 09:58 PM
ok great thanks, I am new to this and i really apreciate your help, thanks a lot, looks like i was out to lunch. :)

tiger
10-20-2002, 11:33 PM
your probally laughing at me but i got one more quick question about this:

//put this actionscript on frame 1
movieClip.onPress = function (){
gotoAndPlay(this._variable);
}

do i have to fill any of that in or insert it just like that. now you really must be laughing

spazmaster
10-21-2002, 11:43 AM
you have to fill that in your actionscript panel, which pops up if you select the first frame and press F9.

you need Flash MX though to use this actionscript...do you have MX?

tiger
10-21-2002, 08:19 PM
yes i do have mx

tiger
10-21-2002, 08:32 PM
when i push F9 i get an accesibility window, is this the ine you mean?