Search tutorials
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 |
| » Author |
| The author is a cancer researcher and Flash developer. |
| » Download |
| Download the files used in this tutorial. |
| Download (138 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


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