Internet Commerce

Partners & Affiliates

Developer Channel


Featured Flash FLA
Gallery Downloads 11401 Flash Movies | 5 New Flash Movies Added
What's New | Top 100

Featured FLA

»  Author: Nick Kouvaris
»  Title: Znax
»  Description: Znax is a board game. Click 4 tiles of the same color and form squares as big as you can. You will erase all the tiles inside the square and collect points. Get maximum score if you make a square with game edges.
»  More by: Nick Kouvaris


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 4941 Flash Sites | 1 New Flash Links
What's New | Top 100 Flash Site

Featured Site

»  Author Agence WOP Digital Agency
»  Title: Electricdrum
»  Description: French WOP Agency, 3D websites, Flash (Papervision, Away 3D), event or institutional projects. The agency operates on all digital projects: consulting, design, graphic design, development, online communication. The WOP agency follows you on the implementation of original, creative and optimized digital projects.


Random Links | Add your own Flash Related Links
Flash Tutorials 1481 Tutorials 7 New Tutorials Added!
What's New | Top100

» How To Make A Simple Animation Using Christmas Clips
» Simple Step by step flash game tutorial Spot the diffrence
» How To Make A Moving Text Slide
» Create Flash Banner With Text Float Effect
» How To Make Zoo Photos Slideshow
» How To Make A Dolphin Photos Slideshow
» How To Make A Fathers Day Slideshow
» How To Make A Transparent Background of Your Flash File
» Create Flash Banner With Text Disco Light Effect Today we will introduce you a Text Disco Light eff
» Unknown Tag: Title10
Random Tutorial | Add Site


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Actionscripting

Categories Actionscript 2 example: creating buttons
Author: Joachim Schnier | Website: http://can_info_guide.tripod.com/ |

 
Page 8
«prev 1 2 3 4 5 6 7 8

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.

«prev 1 2 3 4 5 6 7 8

» Level Intermediate

Added: : 2003-10-30
Rating: 6.08 Votes: 53
Hits: 991
» Author
The author is a basic scientist working in cancer research.
» Download
Download the files used in this tutorial.
Download (25 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments