First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Joachim Schnier | Website: http://can_info_guide.tripod.com/

The Actionscript 2 File

Calling the script from the movie

Now we want to see what how our script affects the movie. To see that, we have to call the class function. Designwise, in our movie we make a movieclip, which we name "buttonClip" and inside there is the text you saw and the 3 buttons. To bring these buttons to life we first import the new class using the import method. So create an actions frame on the main timeline of the movie. We use import because we are lazy and don´t want to write the whole path for the function for every button instance. Next we create instances of the "uButton1" class for each button we have. This is very similar to creating any new object as you know it from AS1. We put the word "new" in front of the class name. We now add the parameters and here we have to be careful as well. Strings are placed within quotations but other parameters not. If we put the button parameter in quotations we will actually be in trouble.

//this imports the script and the whole path has to be specified here
//but not later any more.
import scripts.uButton1;
//we create var of the uButton1 class. Parameters as strings need quotations but 
//not the other parameters. buttonClip.button1 specifies the path where the button is located.
var myButton_1:uButton1 = new uButton1("http://www.flashkit.com","_blank",buttonClip.button1,0xFF8429,0xFF0000);
var myButton_2:uButton1 = new uButton1("http://www.flashkit.com/board/forumdisplay.php?s=e8257289d3a4bcdac5a2939f5a535463&forumid=61","_blank",buttonClip.button2,0x31ADA5,0xFF0000);
var myButton_3:uButton1 = new uButton1("http://www.flashkit.com/board/forumdisplay.php?s=086abae7b05a376b83a624e3616390ae&daysprune=20&forumid=30","_blank",buttonClip.button3,0xDE5AAD,0xFF0000);
And that´s it for today. I hope to see more tutorials about AS2 in the future so I can learn more. Have fun.

» Level Intermediate

Added: 2003-10-30
Rating: 4.8 Votes: 74
(10 being the highest)
» Author
The author is a basic scientist working in cancer research.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.