MACROMEDIA FLASH MX 2004-USING ACTIONSCRIPT IN FLASH Use Manual page 84

Using actionscript in flash
Hide thumbs Also See for FLASH MX 2004-USING ACTIONSCRIPT IN FLASH:
Table of Contents

Advertisement

Attaching ActionScript to a button called
and should be avoided:
on (release) {
//do something
}
However, placing ActionScript with the same purpose on the Timeline looks like the following
code, which is encouraged:
myButton_btn.onRelease = function() {
//do something
};
For more information on ActionScript syntax, see
Note: Different practices apply when using behaviors and screens, which sometimes involves
attaching code to objects. For more information and guidelines, see
object code" on page 105
Choosing between ActionScript 1 and ActionScript 2.0
When you start a new document or application in Flash, you must decide how to organize its
associated files. You might use classes in some projects, such as when you are building applications
or complex FLA files, but not all documents use classes. For example, many short examples in the
documentation do not use classes. Using classes to store functionality is not the easiest or best
solution for small applications or simple FLA files. In these cases, it is often more efficient to put
ActionScript inside the document. In this case, try to put all your code on the Timeline on as few
frames as possible, and avoid placing code on or in instances (such as buttons or movie clips) in a
FLA file.
When you build a small project, it is often more work and effort to use classes or external code
files to organize ActionScript instead of adding ActionScript within the FLA file. Sometimes it is
easier to keep all the ActionScript within the FLA file, rather than placing it within a class that
you import. This does not mean that you should necessarily use ActionScript 1. You might decide
to put your code inside the FLA document using ActionScript 2.0 with its strict data typing and
its new methods and properties. ActionScript 2.0 also offers a syntax that closely follows standards
in other programming languages. This makes the language easier and more valuable to learn. For
example, you will feel familiar with ActionScript if you have encountered another language that's
based on the same structure and syntax standards. Or, you can apply this knowledge to other
languages you learn in the future. ActionScript 2.0 lets you use an object-oriented approach to
developing applications using an additional set of language elements, which can be advantageous
to your application development. For more information on the difference between ActionScript 1
and ActionScript 2.0, see
existing scripts to Flash Player 7" on page
There are cases in which you cannot choose which version of ActionScript to use. If you are
building a SWF file that targets an old version of Flash Player, such as a mobile device application,
you must use ActionScript 1, which is compatible.
84
Chapter 3: Using Best Practices
myButton_btn
and
"Organizing code for screens" on page
"New object-oriented programming model" on page 21
13.
looks like the following ActionScript,
"Writing syntax and statements" on page
"Comparing timeline code with
108.
89.
and
"Porting

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-USING ACTIONSCRIPT IN FLASH and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx 2004 - actionscript

Table of Contents