Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Reset button

Posted on 2004-04-14
5
Medium Priority
?
339 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
[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
5 Comments
 
LVL 9

Assisted Solution

by:j3one
j3one earned 150 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 150 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 600 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 600 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
Suggested Courses

670 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