Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Action scrips variables within a button

Posted on 2003-11-04
3
Medium Priority
?
240 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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 found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
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 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.
Suggested Courses

636 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