Variables ... help!

why doesnt this work
http://home.attbi.com/~xsleeperx2/as/as.fla

i have a variable “i” that is set to a number and then a script tells it to go to a certain frame once it checks the value of “i”

simple?

sniffle stupid variables :stuck_out_tongue:

Change the onPress code on your buttons to be like this…

on (press) {
	_root.gotoAndPlay(_root.i=1);
}

The _root makes all the difference.

_root.gotoAndPlay was added

And I added _root. to the i statement.

@&$^!(#@$^)_!(#$^&!#$^!@#$^)(!@&#
stupid _root … put it on take it off … i keep messin it up

i will get it … _root you hear me? … i will get it!

LOL :stuck_out_tongue:

_root = go to the main timeline

_parent = go to the timeline that contains the clip this time line is in (aka, go back 1 timeline)

it’s working funny now that i changed that … why is it

on (press) {
_root.gotoAndPlay(_root.i=1);
}

why the gotoAndPlay

#&^!(#$)@#$^&!@#$^T i keep trying to reupload the file and you’re on it beta so it gives me an error :slight_smile: go redownload it

_root.gotoAndPlay = play the root

_root.i = the variable is contained on the root timeline, so you need to search for it there…

_root.gotoAndPlay(variable, which converts to frame according to your script)

wtf i can’t re upload my file
Q#$&^!(#$@)#$^(!(*#@ this is lame

anyway … the first 2 buttons seem to work fine but the 3,4, and 5 buttons just play the first frame again

?

this stupid thing is all jacked up !

I will see what I can do, I still have the file saved here.

One question that is racking my brain though…

Why don’t you just use the gotoAndStop action on your button and just have it go to a frame label on the _root timeline?

because i want to be able to have in and out animations i.e. when the user clicks on a button the content that is on the screen animates out of the screen then at the end of that animation there is a variable telling the movie what animation to play next … then it will go to that animation and play the selected content coming in … and so on.

i’m just trying to figure out how to do it before i make all the animations

does that make sense

Lol, I guess so… I still think frame labels would work, but whatever works for you.

I fixed the file… you can download it here…

Download File

This works perfectly fine for me, but the first button blinks for some reason after you click it… you can figure that one out though :stuck_out_tongue:

Everything else works for me though. I moved the frame with your variable actionscript up to the same frame that first contains your buttons and that seemed to fix it.

it blinks because its going to frame 1 and playing through label 1. i don’t understand why it’s doing that. it does that for all the numbers (goes to frame 1 then plays through to whatever the label is)

is there a better way to achieve this … i see it all over on websites so theres gotta be some relatively easy way to do it

I don’t know how to fix this problem.

People do do this all the time on sites, but they have the animation at the end of one of their movies with a button that plays it, and then they have the opening movie in the beginning of their other movie. And loadMovie is used to load each section.

right but how do you set the variable.

when the movie plays its intro it will stop in the middle to show the content then when another button is clicked it will play through the rest and go to the intro for the next bit of content.

but the button is clicked and a play() action should be there as well as something to tell it which movie to loadMovie at the end of the animation

right?

this is a good example of the thing i’m trying to achieve
http://www.triplandesign.com/

Check out this thread…
http://www.kirupaforum.com/showthread.php?s=&threadid=7950&perpage=15&highlight=fade%20from%20blue&pagenumber=2

It is about fading images into eachother. The file to download is the first post on that page (that is, if you kept the default amount of posts per page). It uses variables to check which was the last button pressed so it can find out what to play.

It might help you out.

PS: the file is called background_fade.fla