(Flash CS3) Defining variables to different buttons

Hello all,

My head is rather sore with this problem as I’ve been going round in circles for the last few hours so I’d be hugely grateful if anyone can put me right! I’m using Actionscript 2.0.

I’m trying to assign actions to various buttons for a website I am building, however I would also like to play a little movie first each time before linking to their individual different frames. The movie is the same for each button but then, obviously each button ultimately needs to link to a different frame. I’m guessing a nifty mix of gotoandPlay and variables are the answer but I’m getting myself in knots.

The structure of the site is as follows.

On the main stage I currently have 4 frames. Each frame contains a different “page” of the website. The “home” frame has the navigation bar (including a sub-menu movie which has a number of buttons nested inside it which I think is going to be tricky). At the end of the “home” movie, there is a little fade animation which is labeled/ red flagged on the timeline - and it’s this little animation I would like to have playing when a button is clicked on before linking to another frame.

At the moment the best I can manage is that when the button is clicked it goes back to the beginning of it’s movie (a problem with the target paths perhaps?) as opposed to a label within the parent movie.

I also think where I’m getting confused is exactly where I am supposed to define all the various variables and pieces of actionscript.

Any help would be wonderful, or if you have a simpler way of going about this, well that would be even better. Like I say, I’ve gone round and round with this so I don’t know which way is up anymore.

The little snippits of code I have are as follows:

Within the button I am trying to link, so far I have:

on(release){
_level0.frame_to_goto = “artwork”;
play();
}

The “artwork” tag is the frame specific to that button (this is one of the sub-buttons that is nested within a submenu movie).

Then in the movie for the webpage I have the following in the last frame of the mini animation that I want to play before the button links to the artwork frame:

stop();
if(_level0.frame_to_goto != undefined){
_level0.gotoAndPlay(_level0.frame_to_goto);
}else{
trace(“An error as occured!”);
}

I know I have to define the variable somewhere, but I’m not sure where.

I’m off to make myself a strong brew before I tackle this again!

Thanks in advance and all the very best