First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
Search tutorials
Author: Joachim Schnier | Website: http://www.flashscript.biz

Setting up the fla file

For this particular tutorial file you need only two items: a button and a rectangle movieclip of any size, which we name mask and which stays in the library. Since we need to attach it later to another movieclip, click on the icon in the library and then select linkage from the menu. Click on export for actionscript. Now create five buttons as in our example and one frame for actionscript. Name the buttons but1, but2 and so on. Next we will put a script in the actions frame.

The Actionscript in the Fla File

In the actionscript frame put this script:

import as_scripts.*;
_root.but1.onPress = function() {
    fader.createMC(200, 75);
    fader.fadeoutin("images/pic_1.jpg");
};
_root.but2.onPress = function() {
     fader.fadeoutin("images/pic_2.jpg");
};
_root.but3.onPress = function() {
    fader.maskMC(250, 100, 100, 100);
};
_root.but4.onPress = function() {
    fader.fadeoutin("images/pic_3.jpg");
};
_root.but5.onPress = function() {
    fader.deleteMC();
};
The first line is a wildcard expression and will import all scripts from a folder as_ascripts. I like this shortcut because then I do not have to care any more about the path of any of the scripts in the folder. Then we give functions to the buttons by referring to the fader class. All our functions as you will see are static functions and that is why we have to refer to these functions over the class name. What exactly these functions are you will see in the next section. But as you can see here some of the functions have arguments, either the path and name of a slide or numbers, which as you will see are the x and y coordinates to place objects.

» Level Intermediate

Added: 2004-09-21
Rating: 7 Votes: 6
(10 being the highest)
» Author
The author is a cancer researcher and Flash developer.
» 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: doc_chin7
» Description:

The flash's horizontal road drive was done in CS4 and was upgraded to CS6. The car responds to right/ left key and flash will auto-generate the movement of roads from left-right or right-left based on random number. Have fun driving in this virtual environment and avoid other cars... :) If you are creative, a road driving game can be created from it.

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.