Action scrips variables within a button

Hi there

I'm desperate for help. On my main timeline each subject is presented as a movieclip. They all have a alpha 0 in the first frame. My movie "home" is my intro movie which starts directly. My navigation is a drop down menu.

All movies starts with a fade in - there is a stop on frame 30. On frame 31 the movie fades out again.

To make it simple - let's say there is 2 buttons in my drop dowm menu. Who and Clients. When I press Who button, I have following action script:

on (release) {
if (Who._currentframe != 30) {
_root.Who.gotoAndPlay(2);
}

_root.Home.gotoAndPlay(31);

This works perfect - however it gets more complicated when I ad more scrips to my button. Since when pressing a button, I can always start with the the action script:
on (release) {

if (Who._currentframe != 30) {
_root.Who.gotoAndPlay(2);
}

But how do I set my variables to say that the current playing movie, needs to go to frame 31 (which will make it fade out). Cause if I write

on (release) {
if (Who._currentframe != 30) {
_root.Wht.gotoAndPlay(2);
}
_root.Home.gotoAndPlay(31);
_root.Clients.gotoAndPlay(31);
}

It plays both movies from frame 31 - and that is not what I want.

If someone can please help me - or tell me where to look for the answers I would be most greatful, cause I need to solve this by tomorrow. I will be happy to send the fla, if that might help.

Look forward to hear some comments.

Thanks
Freja_UK
Freja_UKAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

negatyveCommented:
I'm not sure I understand your question, but maybe you mean:

on (release) {
      if (Who._currentframe != 30) {
            _root.Wht.gotoAndPlay(2);
      } else {
      this.gotoAndPlay(31); // ?
      _root.Clients.gotoAndPlay(31);
}
0
Freja_UKAuthor Commented:
I have now tried that - and it doesn't work.

It does start my movie Who - but my movie Home does doesn't fade out, which is should do.

Issue one - the first button I press I need the movie Home to fade out, after that I need to have in each button something to say - go to and play the movie related to the pressed button, and to go and fade out the movie which is already playing.

All movies are builded the same - stop on frame 1 - which is why I always tell it to go to frame 2. Then there is a stop on frame 30, so the fade our happens from frame 31.

But at the moment I´m missing a script, that helps looking for the movie playing. So it knows which movie to fade out. I have managed to get all movies to suddenly come in and fade out, but that looks a bit messy :-)

Did that help?
0
negatyveCommented:
ok, maybe I understand now.
When you start playing a movie, you have to store a reference to that movie, than use that reference the next time you have to fade in a new movie. ie:

on (release) {
      if (Who._currentframe != 30) {
            Who.gotoAndPlay(2);
            // starts fade the last played clip, which
            // reference is inside the _root.alreadyPlaying variable
            _root.alreadyPlaying.gotoAndPlay(31);
            // save "who" as the currently playing movieclip
            _root.alreadyPlaying = this;
      } else {
            Who.gotoAndPlay(31);
            // save null as the currently playing movieclip
            // no clip is played
            _root.alreadyPlaying = null;
      }
}


this is the logic, what you have to change is the path to the movieclip to play (this, or who, I don't know...)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.