
429
USING FLASH CS4 PROFESSIONAL
Best practices
The controller
Handles the requirements of the model and view to process and display data, and typically contains a
lot of code. It calls any part of the model, depending on user requests from the interface (or view), and contains code
that’s specific to the application. Because this code is specific to the application, it is usually not reusable. However, the
other components in the design pattern are reusable. The controller does not process or output any data, but it takes
the request from the user and decides what part of the model or view components it needs to call, and determines
where to send the data and what formatting is applied to the returned data. The controller ensures that views have
access to parts of the model data that they must display. The controller typically transmits and responds to changes
that involve the model and view.
Each part of the model is built as a self-contained component in the overall process. If you change one part of the model
(for example, you might rework the interface), the other parts of the process do not usually need modification, which
reduces problems. If your design pattern is created correctly, you can change the view without reworking the model
or controller. If your application does not use MVC, making changes anywhere can cause a rippling effect across all
your code, which requires many more changes than if you were using a specific design pattern.
An important reason to use the MVC pattern is to separate data and logic from the user interface. By separating these
parts of the process, you can have several different graphical interfaces that use the same model and unformatted data.
This means that you can use your application with different Flash interfaces, such as an interface for the web, one for
Pocket PC, a version for cell phones, and perhaps an HTML version that doesn’t use Flash at all. Separating data from
the rest of the application can greatly reduce the time it takes to develop, test, and even update more than one client
interface. Similarly, adding new front ends for the same application is easier if you have an existing model to use.
Only use MVC if you build a large or complex application, such as an e-commerce website or an e-learning application.
Using the architecture requires planning and understanding how Flash and this design pattern work. Carefully
consider how the different pieces interact with each other; this typically involves testing and debugging. When you use
MVC, testing and debugging are more involved and difficult than in typical Flash applications. If you build an
application in which you need the additional complexity, consider using MVC to organize your work.
Creating secure applications
Dishonest users might try to hack your application, whether you build a small portal site where users can log in and
read articles or a large e-commerce store. For this reason, consider the following steps to secure your application.
•
Post data to HTTPS for data that needs to be secured. Encrypt values in Flash before sending them to a remote
server to be processed.
Important:
Never store any information or code in a SWF file that you don't want users to see. It is easy to disassemble
SWF files and view their contents using third-party software.
•
Add a cross-domain policy, which prevents unauthorized domains from accessing your assets.
Accessibility guidelines
About accessibility guidelines
Screen readers are complex, and you can easily encounter unexpected results in FLA files developed for use with screen
readers, which is software that visually impaired users run to read websites aloud. Text is read aloud using specially
designed software. A screen reader can only interpret textual content. However, any descriptions that you provide for
the overall SWF file, movie clips, images, or other graphical content are also read aloud. Write descriptions for the
important images and animations so that the screen reader can also interpret these assets in your SWF file. This is the
SWF file equivalent to
alt
text in an HTML web page.
Updated 5 March 2009