Flash CS3 Tutorials, Functions
74- Flash CS3 Tutorials, Home Page
F2, is a website dedicated to teaching Flash CS3, You will find all kinds of Flash CS3 Tutorials - Adobe Flash, The Information You Need
This website id dedicated to teaching Flash, You will find all kinds of Flash CS3 Tutorials and other great flash information.
Functions
In Flash CS3 Functions enable ActionScript to reuse certain pieces of code over and over. You can define some set of action within a function and then call that function whenever you need the code to run.
When building a function you start the line of code with the word function then the name of the function (basically whatever you want), a pair of parentheses and curly braces. What you want the function to do is contianed inside the curly braces. To call the function you simple need to call it by name, such as aName().
Construct a function
Click on the first key frame on the time line layer called actions and press F9 to open the actions panel.
then add the following code:
function textArea(){
var myText:TextField = new TextField();
myText.text = "F2 Training";
this.addChild(myText); };
textArea();
function textArea() creates a new function called textArea. var myText creates a new variable called myText, :TextField is data typing which tells flash and programs what type of data will be contained within the variable you just created.
= new TextField(); defines the variable myText as having the value of new TextField(); The next line of code myText.text = "F2 Training". Is telling Flash that the variable myText has a .text property and that it's value is "F2 Training". This is basically the same as drawing a text field on the stage, naming it myText and then typing F2 Training inside that text field. The differance is that this text field is dynamically controlled and can be called on whenever it may be needed. The last line this.addChild(myText); simple adds the new text field myText to the stage and then places the value inside that text field.
Press Control-Enter to see what you created.
Ok, so lets make the text filed more useful by passing a set of parameters. A parameter is a quantity or value that defines a certain characteristic of the function. It will make sence as we continue. Return to the actions panel and modify the text already inplace.
See Example
function textArea(parameter:String){
var myText:TextField = new TextField();
myText.text = parameter; this.addChild(myText);
};
textArea("this is a parameter");
The word parameter in this case is a variable that you can name just about anything. Again, we see data typing in the form of :String. The data type string tells the programer and Flash that this variable will contain text. This parameter allows you to change the phrase every time you call the function.
Press Control-Enter and test you movie.
looking for Source Files see link at top
Flash CS3 Tutorials, Copyright FrenchSquared 2008
- Mysapce Mobsters
Mobsters is a game I recently started playing on Myspace. It is a textual based game similar in design to the original Dungeons and Dragons. The difference is that Mosters is an online game with over 8 million users. Due...
- Adobe Flex Builder Linux Public Alpha
Update: Flex Builder Linux alpha 4 was released on 8/14/2008. Please download alpha 4. Welcome to the Adobe® Flex™ Builder™ Linux alpha on Adobe Labs. Flex Builder Linux is a plugin-only version of the Flex Builder that you can use...
- MySpace and Mobsters
If your into Myspace app's expecially Mobsters you need to check out, www.MySpaceFruitloops.com. It is a new and upcpming forum that has all kinds of information on your favority MySpace Apps. They have stats calculator and quick ad links for...
- Photoshop Express Beta
t Photoshop Express you can quickly and easily accentuate your photos with easy-to-use options for resizing, cropping, sharpening, and more. Make your photos pop with fun, eye-catching effects and enhancements. Then share your photos in My Gallery, where you can...
- Improved Flash indexing
Q: Which Flash files can Google better index now?We've improved our ability to index textual content in SWF files of all kinds. This includes Flash "gadgets" such as buttons or menus, self-contained Flash websites, and everything in between.Q: What content...
Share it! — Rate it: up down [flag this hub]

