Lesson 2 - My First Actionscript

Don Von Alpha Dom
by Don Von Alpha Dom · 6 posts
15 years ago in Flash
Posted 15 years ago · Author
Warning: the way to add code to buttons has changed since these videos were made

How do add actionscript to a button:
1) click on your button, and name your button in the properties tab
2) add a new layer
3) right click the stage in the new layer and click actions to open the actionscript window
4) add the following code
Code
yourButtonNameHere.addEventListener(MouseEvent.CLICK, myButtonNameHereFunction);

function myButtonNameHereFunction(event: MouseEvent)
{

 WRITE CODE FOR THIS BUTTON HERE

}


Watch the following videos in order:
1) http://www.youtube.com/watch?v=U49_tSB_HrE
2) http://www.youtube.com/watch?v=nYkIMVO5 ... 1B&index=7
3) http://www.youtube.com/watch?v=rmhc8Dsy ... 1B&index=9

Assignment:
For this assignment we will be creating a music video. Your flash assignment should include your favorite song, some animations, custom buttons, and a link to the band's website.

01) Draw your own play, stop, pause, skip, back, and jump button onto the stage, do not use buttons that are already in the library

02) Convert each button you drew into button symbols, re-watch video 3 if you do not remember how to create custom buttons

03) Import your favorite song into the project

04) Drag the song onto the stage, see assignment 1 instructions if you do not remember how to add sound

05) Name your first layer "GUI", and stretch it to the length time line to the length of the song

06) add an action to the play button, and code the movie to play when the button is clicked

Code
On(release)
 {
 play();
 }


07) add an action to the stop button, and code the movie to stop when the button is clicked

Code
On(release)
 {
 gotoAndPlay(1);
 }


08) add an action to the pause button, and code the movie to pause when the button is clicked

Code
On(release)
 {
  stop();
 }


09) add an action to the jump button, and code the movie to jump when the button is clicked, place the frame number of the frame containing your favorite part of the song into the "gotoAndPlay" method

Code
On(release)
 {
  gotoAndPlay();
 }


10) coming soon
Last edited by Don Von Alpha Dom on Mon Nov 30, 2009 2:32 pm, edited 1 time in total.
Posted 15 years ago · Author
Ok, I am going to have to ask that no one goes past lesson 2.

I have the assignment done, but actionscript has changed enough over the past year, that these videos will do not provide with the information needed to complete assignment 2. I have not been able to find an up to date video, so I am going to make my own. I have already gathered the necessary software and hardware. I will be making the new video for this lesson on Tuesday, and should have it online by Thursday morning.

Thank you for your patience, and I am sorry for the delay,
Professor Don Von Free Credits =;
Posted 15 years ago
Don did you make the new video tutorial or not yet ?
Posted 14 years ago
cool
Posted 13 years ago
Thanks! :wink:

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here

SIGN IN NOW

Create an account

Sign up for a new account in our community. It's easy!

REGISTER A NEW ACCOUNT