Solved

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

Posted on 2007-04-02
6
160 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
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 what frame rate is, how to control it and what effect it has on the video.

757 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

22 Experts available now in Live!

Get 1:1 Help Now