Solved

Action scrips variables within a button

Posted on 2003-11-04
3
219 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

825 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