Solved

Action scrips within a dropdown menu

Posted on 2003-11-03
3
176 Views
Last Modified: 2010-04-03
Hi there

I have created a website with a dropdown menu. However, I can't seam to get it to work properly. All my buttons activate a movie, so when I press a new button I need to tell it not only to go and play a new movie, but also to finish the movie I'm on.

This is what worked between two buttons

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

Unfortunately that doesn't work when I start adding other movies - how do I specify what movie is playing now - and in that case - need to fade out from frame 31 - because a new movie is starting to fade in. When I use the command above for several movies, they all come in and do the fading out. But I only want the movie which is playing to leave.

Can anyone help?

Thanks
Freja_UK
0
Comment
Question by:Freja_UK
3 Comments
 

Expert Comment

by:amotaz
ID: 9676053
I am not sure I quite get the problem, but as far as you can simply keep track of the currently playing movie.

Create like a variable and on playing any movie, just set that variable to the movie's name. And when you want to stop the currently playing movie, just eval(your variable) and stop it.
0
 

Author Comment

by:Freja_UK
ID: 9677733
I'll explain some more. Cause I know in my head what I want it to do - but the different commands I have tried doesn't work, and I know that is due to lack of knowledge from my side.

Let's say that there is three buttons in my drop down, each need to activate a movie - each one starting on frame 2 in the movie. At the same time, the movie playing when I press another button, needs to leave the scene at the same time as the other one come in. All they do is fade out, and the new one fade in.

When I enter the site, the first movie to be played is Home, so the first time I press a button - I need it to say play new movie frame 2 and to say leave the movie I'm playing from frame 31 (where it fades out).

As you can see above, can I get it to work between only two buttons. However, since that worked, I thought that I could add

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

But when I did that - both Home and About appeared on the screen and played from scene 31 and out. How can I write my variables, so that when I press a new button, it knows which movie to fade out?

Did that make more sense? If not, please tell me what you need to know. It is urgent that this problem gets solved.

Thanks
Freja_UK
0
 
LVL 5

Accepted Solution

by:
Calron earned 500 total points
ID: 9685027
What you can do is maintain variables that contain the current movie and the new movie. Something like this:

_global.currentMC = _root.Home; // this is to initialize variables at the beginning


then in you button add this code:

// the about button
on (release) {
  //fade out the current movie
  _global.currentMC.gotoAndPlay(31);
 
  // fade in the About movie
  _root.About.gotoAndPlay(2);

  // make sure that now the About movie is the current movie
  _global.currentMC = _root.About;
}
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now