Specifications
CHAPTER 2
20
When you embed an asset, you compile it into your application’s SWF file. The advantage to embedding an asset
is that it is included in the SWF file, and can be accessed faster than having to load it from a remote location at
run time. The disadvantage of embedding is that your SWF file is larger than if you load the asset at run time.
If you decide to access an asset at run time, you can load it from the local file system of the computer on which
the SWF file runs, or you can access a remote asset, typically though an HTTP request over a network.
A SWF file can access one type of external asset: local or over a network; the SWF file cannot access both types.
You determine the type of access allowed by the SWF file by using the
use-network flag when you compile your
application. When you set the
use-network flag to false, you can access assets in the local file system, but not
over the network. The default value is
true, which lets you access assets over the network, but not in the local file
system.
For more information on the use-network flag, see “Using the Flex Compilers” on page 125. For more infor-
mation on embedding application assets, see “Embedding Assets” on page 965 in the Adobe Flex 3 Developer
Guide.
Sharing MXML and ActionScript files among applications
You can build an entire Flex application in a single MXML file that contains both your MXML code and any
supporting ActionScript code. As your application gets larger, your single file also grows in size and complexity.
This type of application would soon become difficult to understand and debug, and very difficult for multiple
developers to work on simultaneously.
Flex supports a component-based development model. You use the predefined components included with Flex to
build your applications, and create components for your specific application requirements. You can create custom
components using MXML or ActionScript.
Defining your own components has several benefits. One advantage is that components let you divide your appli-
cations into modules that you can develop and maintain separately. By implementing commonly used logic within
custom components, you can also build a suite of reusable components that you can share among multiple Flex
applications.










