Solved

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

Posted on 2007-04-02
6
167 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
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 what frame rate is, how to control it and what effect it has on the video.

773 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