Solved

Action scrips within a dropdown menu

Posted on 2003-11-03
3
177 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

776 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