Solved

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

Posted on 2009-03-31
5
890 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
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 how to record live broadcast.

760 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

23 Experts available now in Live!

Get 1:1 Help Now