PROGRAMMING COURSES ADMIN VIDEO TUTORIALS COMMUNITY RESOURCES |
Functions are the real meat and potatoes of programming in any language.
Why would ActionScript 3.0 be any different. There are two types of
function types in ActionScript 3.0. The built-in
core functions, and user defined custom
functions that we can create for any purpose.
Functions help you reuse code blocks and code logic many times. We use built-in core functions all the time and do not even realize that we are calling a function. The built-in core functions already have a process that they undergo using the built in functionality of the language. It happens behind the scenes. Custom functions we create are fed their logic and variable manipulation by us so we can view all that occurs inside the function. Built-in core function examples Round a decimal number using the Math.round() built-in core function ![]() var myNum:Number = 5.7;
6
There are many built-in core functions, here we just used two. Math.round(), and trace(). We will cover many more in later sections. Now do we know what happened to those values exactly? When we passed them through the function we could imagine what took place but we cannot see it. It just performs the magic for us, and returns a new adjusted value. The people who create and add to the ActionScript 3.0 programming language add the core functions. They place lines of code that modify the variable values we send into them when called. Custom user defined functions are much more interesting because we create them to modify variables in the way that we see fit, and more of a hands on approach to data manipulation and evaluation.
|
|||||||||||
|
|
DevelopPHP Requires Flash Player
___________________________________________
|
||||||||