Chapter 27. Loading External Assets
While building your Flex applications, you will undoubtedly run into scenarios where you will need to load external assets into your application. Luckily, the Flex framework makes this task extremely easy for you. Flex has built-in classes that make the act of loading an external image or Flash file painless and easy, and if those classes don't suit your needs, you can use the lightweight Loader
class and take on some of the logic yourself. The focus of this chapter will be methods of loading assets into your application.
Depending on the type of application that you are building, loading external assets can be an extremely important feature. You may not want to include all the visual assets embedded into your application for a variety of reasons; assets could make the file size too large, or assets may be loaded dynamically based on application data. Another case is that you do not have control over assets; they are served from a server/domain that you do not administer.
When we talk about loading assets at runtime, it is also important to understand what we mean by assets. Assets are multimedia elements that can be loaded into your application. They can be images, Flash files, audio, or video content.
In this chapter, we will only focus on the basics — images and SWF files. Chapter 28, "Video and Sound," will discuss audio and video in greater detail.
Loading Images
Working with images is a task made easy by Flex. You can load images, monitor loading ...
Get Professional Adobe® Flex® 3 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.