Macromedia flex 2-migrating applications to flex 2 Manual De Usuario

Descargar
Página de 184
Accessing request data
183
Using the Preloader
The Application container supports an application preloader that uses a download progress 
bar to show the download progress of an application SWF file. By default, the application 
preloader is enabled. The preloader keeps track of how many bytes are downloaded and 
continually updates the progress bar. 
By default, the application preloader uses the DownloadProgressBar class in the mx.preloaders 
package to display the download progress bar. To create a custom download progress bar, you 
can either create a subclass of the DownloadProgressBar class, or create a subclass of the 
flash.display.Sprite class that implements the mx.preloaders.IPreloaderDsiplay interface. 
The operation of the download progress bar is defined by a set of events. These events are 
dispatched by the Preloader class. A custom download progress bar must handle these events.
For more information, see Chapter 14, “Using the Application Container,” in the Flex 2 
Developer’s Guide
Accessing request data
You can pass request data to any Flex application by using 
flashVars
 variables in the 
<object>
 and 
<embed>
 tags in the wrapper. If you are using Flex Data Services, you can 
specify the request data as query string parameters. The server converts these to 
flashVars
 
variables when it generates the wrapper. The 
flashVars
 variables are a series of URL-encoded 
name and value pairs, as the following example shows:
flashVars='firstname=Nick&middlename=D&lastname=Danger'
The way in which you access these variables is changed. In Flex 1.x, you could access the 
values of 
flashVars
 variables by declaring a public global variable of the same name. Using 
the previous example, you could access the values of the 
firstname
middlename
, and 
lastname
 variables in your Flex application by just declaring them, as the following example 
shows:
<mx:Script>
var firstname; // Initialized to "Nick”.
var middlename; // Initialized to "D”.
var lastname; // Initialized to "Danger”.
</mx:Script>