First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
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: 5.12 Votes: 68
(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!

Comments

  • 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: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
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: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.