Solved

Action scrips variables within a button

Posted on 2003-11-04
3
210 Views
Last Modified: 2010-04-03
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
0
Comment
Question by:Freja_UK
  • 2
3 Comments
 
LVL 27

Expert Comment

by:negatyve
ID: 9680100
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
 

Author Comment

by:Freja_UK
ID: 9680437
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
 
LVL 27

Accepted Solution

by:
negatyve earned 500 total points
ID: 9680834
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

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

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…
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.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

911 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