EasyManua.ls Logo

MACROMEDIA FLASH 8-USING FLASH - Page 341

MACROMEDIA FLASH 8-USING FLASH
678 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Understanding screen-based documents and the screen authoring environment (Flash Professional only) 341
New Flash users frequently like the visual approach of placing ActionScript for a particular
screen directly on an object. When you click the screen or a movie clip, you see the code that
corresponds to the instance or the name of the function that’s called for that instance. This
makes navigating an application and associated ActionScript visual. It’s also easier to
understand the hierarchy of the application while in the authoring environment.
If you decide to attach ActionScript to symbol instances on the Stage and directly on screens,
try to place all your ActionScript only in these two places to reduce complexity.
If you place ActionScript on screens and either on the Timeline or in external files, try to place
all your ActionScript in only these two of places to reduce complexity.
Using external ActionScript
You can organize your screen-based FLA file by writing external code and not having any code
in the document. When you use external ActionScript, try to keep most of it in external AS
files to avoid complexity. Placing ActionScript directly on screens is acceptable, but avoid
placing ActionScript on instances on the Stage.
You can create a class that extends the Form class. For example, you could write a class called
MyForm. In the Property inspector, you would change the class name from mx.screens.Form
to
MyForm. The MyForm class would look similar to the following code:
class MyForm extends mx.screens.Form {
function MyForm() {
trace("constructor: "+this);
}
}
Working with other structural elements
A screen-based document, when published, is essentially a single movie clip on the first frame
of a Timeline. This movie clip contains a few classes that compile into the SWF file. These
classes add additional file size to the published SWF file compared with a nonscreen-based
SWF file. The contents load into this first frame by default, which might cause problems in
some applications.
You can load content into a screen-based document as separate SWF files onto each screen to
reduce the initial loading time. Load content when it is needed, and use runtime shared
libraries when possible. This approach reduces what the user needs to download from the
server, which reduces the time that the user must wait for content if they do not have to view
each different part of the application.

Table of Contents

Related product manuals