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
Solved

Using a button to play an animation then jump to another frame

Posted on 2007-04-02
6
169 Views
Last Modified: 2010-04-03
I'm designing a navigation sytem in flash. On clicking a button on the timeline I want to play a short animation, then go to the relevant frame where I will load in the content. If the animation starts on frame 2 and ends on frame 10 with a stop action, what actionscript should I put on the button for say the contact page in order for it to gotoAndPlay (2) then gotoAndStop("contact"),
0
Comment
Question by:DallySP
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:ieciep
ID: 18836084
button action:
----------------
on(release)
{
gotoAndPlay (2);
}

Frame 10 action:
-------------------
on keyframe number 10 write this action:

gotoAndStop("contact");

when your animation is ended on frame 10, you are moved to your desired frame i.e. with contact label.
0
 

Author Comment

by:DallySP
ID: 18836310
The problem is I have more than one page. I have a page for contact, a page for about us etc. When each one's button is pressed I need the timeline to play the animation between 2 and 10, THEN go to "contact" which is on frame 30, or "about us" which is frame 40 etc. I wondered if there was an actionscript instruction that allowed you to do one action and on completion do another all on button - does that make sense?
0
 
LVL 11

Accepted Solution

by:
sibgig earned 125 total points
ID: 18837123
// on frame 1 stop & declare a few variables

stop();
var aboutus:Boolean = false;
var contact:Boolean = false;
var home:Boolean = false;

**************

// about us button on frame 1

on(release){
      aboutus=true;
      gotoAndPlay(2);
      trace(aboutus);
}


// contact button on frame 1

on(release){
      contact=true;
      gotoAndPlay(2);
      trace(contact);
}


// home button on frame 1

on(release){
      home=true;
      gotoAndPlay(2);
      trace(home);
}

**************

// compare on frame 10

if (aboutus==true) {
      gotoAndStop("aboutus");
}

 else if (contact==true) {
      gotoAndStop("contact");
}

 else {
      gotoAndStop("home");
}
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 11

Expert Comment

by:sibgig
ID: 18837135
you can omit the lines that begin with "trace"

i just used that to test and verify.
0
 

Author Comment

by:DallySP
ID: 18837901
That brilliant - thanks very much.
0
 
LVL 11

Expert Comment

by:sibgig
ID: 18840915
glad i could help.

0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

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…
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 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.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

856 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