PDA

View Full Version : help with variables


Liquidsword
02-16-2006, 01:52 AM
Aight so I want to set a variable when a button in a movie clip is clicked. For the button I have;

on(release){
_parent._parent._parent.gotoAndPlay(11);
page = links;
}
There are also a few other buttons that change the variable page when pressed.

Its jumping to frame 11 of another movie clip and plays until it gets to frame 20, in which I have this code.

if (page == home){
_root.gotoAndStop(1)
} if (page == pivot){
_root.gotoAndStop(2)
} if (page == flashy){
_root.gotoAndStop(3)
} if (page == links){
_root.gotoAndStop(4)
}
and as you can see, there are a few different variables. Problem is none of it works.

if I clicked the links button and make the variable page = links; shouldnt when it goes by that code on the timeline jump to frame 4 of the main timeline?

thanks for any help, if you could even understand that. lol

peteranselmo
02-16-2006, 01:55 AM
are you trying to set the page variable to a string? you'll need to put the quotes around the links..

page = 'links';

and

if (page == 'home'){
_root.gotoAndStop(1)
} if (page == 'pivot'){
_root.gotoAndStop(2)
} if (page == 'flashy'){
_root.gotoAndStop(3)
} if (page == 'links'){
_root.gotoAndStop(4)
}

Liquidsword
02-16-2006, 02:13 AM
those arnt links, they are variable values.
are you trying to set the page variable to a string?
im not sure what you mean. Ive never used variables in flash before now so any help would be helpful

peteranselmo
02-16-2006, 02:22 AM
when you set a variable.. you can set it to a number

myNumber = 1;

or a string

myString = 'hello';

with your code above you had:
page = links;

when you should have
page = 'links';

add the quotes around your page names and that should solve your problem or post your fla and i'll help you out some more..