Solved

How do you perform a simple "frame jump" in Adobe Flash CS4 using actionscript 3?

Posted on 2009-03-31
5
893 Views
Last Modified: 2013-11-11
Experts,

I am trying to do a very simple task by placing a button (some text) in my flash movie, and when clicked on, it will jump to another frame a little further down the time-line in the same scene.

I have scoured the net looking for the code to insert and I can not find it anywhere. I know this is got to be a very simple task and I apologize for being so actionscript 3 / flash ignorant.

Thanks for your help.

Matt
0
Comment
Question by:Matt_Mercurio
  • 4
5 Comments
 
LVL 12

Accepted Solution

by:
scooby_56 earned 500 total points
ID: 24033063
btn.addEventListener(MouseEvent.CLICK, onClick)   //replace btn with the name of your button
function onClick(e:MouseEvent){
      gotoAndPlay(30); //30 is the frame number
}
0
 

Author Comment

by:Matt_Mercurio
ID: 24033492
Thanks Scooby.....I am going to try this code....Ill post a reply tonight.

Thanks again....
Matt
0
 

Author Comment

by:Matt_Mercurio
ID: 24034094
Hey Scooby...thanks for the code it works. However, I have a related problem. I apologize I didn't tell you this up front...I just didn't think it made a big difference but apparently it does.

Anyway, here is the issue, I have four other buttons in the scene that I have applied this same code too. When I applied it to just one button in the scene...all is well. However, the minute I apply it to the other buttons, I get the following error message.

"1021: Duplicate function definition."

Thanks,
Matt
0
 

Author Comment

by:Matt_Mercurio
ID: 24034282
Scooby...nevermind...I got it! The minute I hit the post button...I realized that I need a unique function name.

Thanks for your help!
0
 

Author Closing Comment

by:Matt_Mercurio
ID: 31565021
Thnx Scooby!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Question has a verified solution.

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

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

809 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