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

x
?
Solved

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

Posted on 2007-04-02
6
Medium Priority
?
175 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 375 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

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!

Question has a verified solution.

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

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
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…

722 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