Solved

Reset button

Posted on 2004-04-14
5
299 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
ID: 10828462
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
ID: 10828791
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
ID: 10829866
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
ID: 10829949
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
ID: 10840739
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

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

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
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…
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 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.

895 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

14 Experts available now in Live!

Get 1:1 Help Now