Chapter 28: Using Flash ActionScript

 < Day Day Up > 



 Download CD Content

Overview

Flash MX uses ActionScript (a scripting language) to add interactivity to your movies. ActionScript is used for things such as navigation, arcade type games, puzzles, sound, banners, and communicating with a server for things like chat or e-commerce activities, such as login and registration. ActionScript is a powerful yet relatively easy scripting language to learn.

ActionScript is based on JavaScript, which is an object-oriented language, so if you know JavaScript you will learn ActionScript quickly. JavaScript controls objects in the browser; ActionScript controls the objects in a Flash movie. An object only knows about itself and only does things that relate to itself. Because each object is separate it is reusable and it can be used as often as needed.

An object allows programmers to define the data type of a data structure as well as functions that can be applied to the data structure. As a result the object includes both data and functions. Because of this, objects can inherit characteristics from other objects. Object-oriented programming is easier to modify because you can create modules that don't need to be changed every time a new type of object is added because the new object can inherit from existing objects.

Flash MX uses a syntax called dot syntax, which is similar to the format programmers are familiar with. Not only will a programmer be more comfortable using the dot syntax, using it adds a lot more power and flexibility. The dot syntax is a scripting language that adheres closely to the same specifications that are based on JavaScript. It's an object-oriented programming language with code that looks like this:

object.property=value; or object.methods();

In this statement four things need defining: the object, properties, values, and methods. For example, a Movie Clip object has properties (characteristics) that can be changed. The data that goes with the properties is the value. A dot separates a clip instance from its property, its nested clip instances, and its variables.

Like any new language you are trying to learn, there is a learning curve. You have to learn a few rules of the language. You'll have to learn to speak Flash's language, which is ActionScript. If you tell Flash to "move the ball," it can't comply if it doesn't understand. You have to tell it how big the ball is, how far to move it, and where to move it to. Some information Flash needs is which direction it should it move it and how long should it keep moving. Thinking through the specifics of what you want to happen is the first step to making your Flash movie — before you write any code.

Because ActionScript is such a huge topic it's impossible in the scope of this book to even cover a minute amount of the possibilities. We will go over the basics and some of the more common actions in this chapter. There is a large project which allows you to experiment first hand with using actions.

On the CD-ROM 

There are two additional tutorials in the Bonus Tutorials folder. There are also links to various Flash resources on the Links page on the CD.

If you are serious about ActionScript I highly recommend you purchase Macromedia Flash MX ActionScript Bible.



 < Day Day Up > 



Macromedia Studio MX Bible
Macromedia Studio MX Bible
ISBN: 0764525239
EAN: 2147483647
Year: 2003
Pages: 491

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