Solved

Reset button

Posted on 2004-04-14
5
286 Views
Last Modified: 2010-04-03
How do i set-up a reset button that when pressed returns several different movie clips in one scene back to their respective first frames...cheers

mf
0
Comment
Question by:Matt22
5 Comments
 
LVL 9

Assisted Solution

by:j3one
j3one earned 50 total points
Comment Utility
You could make a button that tells it to go to a frame with nothing on it, and tell that frame to go back to the frame it just came from. basicaly resetting the animation. I am sure there is an actionscript way to do this though...
0
 
LVL 4

Assisted Solution

by:RedLava
RedLava earned 50 total points
Comment Utility
Hi Mat22,

How are these movies created? Are they loaded at run time?

However they are loaded record which movies they are in an array. If they are loaded dynamically then just add the name to the array when it is loaded or hard code it at design time.
Then loop through the array using the values as the movie name and use the go to and stop method to go to frame 1 of the movies.

Do you have the code you use to create the movies? Post it and I can write the actionscript you need.

RedLava
0
 
LVL 2

Assisted Solution

by:hansblix
hansblix earned 200 total points
Comment Utility
if you want to do this for all movieclips in the current timeline:

for (i in this)
{
    if (typeof(this[i]) == "movieclip")
    {
        trace("resetting movieclip : " + this[i]);
        this[i].gotoAndPlay(1);
    }
}
-h
-----------
http://www.quillem.com
0
 
LVL 9

Accepted Solution

by:
krishnaprathab earned 200 total points
Comment Utility
Yes hansblix is right. You can use the similar function below to do it independent of your timeline.

ResetButton.onPress = function()
{
      for (var i in this._parent)
      {
            if (typeof(eval(i)) == "movieclip")
            {
                  eval(i).gotoAndStop(1);
            }
      }
}

Thanks,
KP
0
 
LVL 2

Expert Comment

by:hansblix
Comment Utility
krishnaprathab :
  Try and avoid eval as much as possible as it's not really recommended.. Left side evals are known to be buggy when used in assignment statments, but generally I recommend that you don't use it at all :)
  use array notation always..

Just a thought..
-H
---------------
http://www.quillem.com
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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 the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
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.

762 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

6 Experts available now in Live!

Get 1:1 Help Now