Solved

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

Posted on 2007-04-02
6
170 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
[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
  • 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:
Tom Ray 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
Independent Software Vendors: 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!

 
LVL 11

Expert Comment

by:Tom Ray
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:Tom Ray
ID: 18840915
glad i could help.

0

Featured Post

Technology Partners: 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

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…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to record live broadcast.

726 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