Lesson2.Functions


Lesson 2. Functions

When programming, you might find yourself using the same chunks of code repeatedly either by copying and pasting them or by rewriting the same lines of ActionScript. There is a way to write ActionScript just once and reuse it any time with a single action. You do this with functions, and the action by which you execute a function is a call or a function call. Functions are real time-saversduring both development and code maintenancebecause they reduce the amount of code you need to write or modify. Think of a function as a mini-program that serves a specific purpose within another application. You can use it to perform a set of specific actions, you can feed it information and output a resultor you can do both. Functions provide a powerful and versatile way to script your project.

You will create several functions that allow you to turn a Flash-TV on and off and change its channels. A Flash-TV is a simple Flash app that acts like a TV and remote control.

In this lesson, you'll learn how to create and use functions while developing a remote control for a Flash-made television set.




Macromedia Flash 8 ActionScript Training from the Source
Macromedia Flash 8 ActionScript: Training from the Source
ISBN: 0321336194
EAN: 2147483647
Year: 2007
Pages: 221

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net