1. Flex Application Lifecycle The flex application is essentially a flash application, but it is based on the Flex Framework (written by ActionScript). The root object of the Flex application is Systemmanager (not the application root element we see on the Flex application), inherited from Flash.dispaly.movieclip-flash player display type, MovieClip is an object that supports timeline base frame frames, Systemmanager is special in the Flex framework, contains two frames (all other component are one frame), respectively, Preloader and real application,preloader frames can be downloaded quickly and used to display application download progress, once the Flex application Systemmanager instance into the second frame, The Flex Master Application application instance is created and given its own property application (null before entering the second frame), since the internal lifecycle and events of this application (Flex Master application) begin to function:
Preinitialize:application has been instantiated but has not created any child component
Initialize: Child component has been created but laid out (lay out)
Creationcomplete:application has completed instantiating and completed the layout of all child component
Systemmanager has a Toplevelsystemmanager object that points to a Systemmanager instance and is the root of any object currently running in Flash Player (root), If Flex is loaded as a primary application to Flash Player, the above properties will point to itself (self-refrencing), but when flex applications are loaded by another flex application, The Toplevelsystemmanager property of its own systmenmanager is not a self reference, but rather a systemmanager instance of its parent application. All uicomponent subclasses have a Systemmanager attribute that points to the Systemmanager instance of the application, which has the final processing power on the event-handling chain when the component event that is being monitored by the systemmanger instance bubbles.
2, the difference between Flash Palyer and Framwork Flash Player is the operating environment for flex applications and Flash applications, both of which have a fully equal operating right (via the API provided by Flash Player), and two applications form. swf files are the same performance in Flash Player, The difference is not the content of the application but the way it is created. The Flex Framework provides a layer of abstraction for applications between development and execution, and the Flex application compiles the necessary Framwork library into the. swf file (which also affects the size of the application file), the main flash Player Class, of course, will not be compiled into. swf because they already exist in Flash Player and eventually form instructions that Flash Player can understand with flash applications.
The distinction between Flash Player class and Flex framework is convenient, with the first class starting with Flash, such as Flash.net.URLLoader, and the latter starting with MX, such as Mx.controls.Button
3, dynamic load of another flex application <mx:swfloader source= "src/*.swf"/>
The Swfloader content attribute points to the Systemmanager instance of the Flex application being loaded (its application attribute points to the application instance that is loaded into the FELX application), Swfloader loading, Initializing an INIT event when it is loaded into a flex application can be dispatch with a Applicationcomplete event that listens to the Systemmanager instance that is loaded into the flex application. The Application object that is loaded with content when the event occurs can refer to the
and Inithandler in Event.target.content.addEventListener (Flexevent.application_complete,func);
Event.target.application.method with Applicationcompletehandler ...
4. Understanding Application Domains (application domain) An application domain (similar to. NET Appdoamin) has the relevant class definitions, resources, etc. for flex applications, and new flex applications that are loaded can exist in a new, isolated domain (for additional memory resources), Can exist in the doamin of the current domain (the resources that share the parent domain, the class definition, the case where the class definition is superseded), and can be directly present in the current doamin (Also note class definition conflicts), such as the runtime shared library.
Code to implement these three ways of application (mainly applied to Flash.system.LoaderContext, Flash.display.Loader or Flash.net.URLLoader, Flash.system.ApplicationDomain)
var context:loadercontext = new Loadercontext ();
Context.applicationdomain = new Applicationdomain (applicationdomain.currentdomain);//load as child domain
Context.applicationdomain = new Applicationdomain ();//load as new domain
Context.applicationdomain = applicationdomain.currentdomain;//load current domain
var request:urlrequest = new URLRequest ("runtimeloadingexample.swf");
var loader:loader = new Loader ();
Loader.load (request, context);
5. About Preloader Preloader is a lightweight class that is instantiated in the first frame of Systemmanager, Preloader Dispatch out a series of events, and the Progress interface is implemented by the loading bar listener, Once applied into the second frame pending application initialization, the System Manager notifies the preloader of initialization progress, Preloader notifies system Manager that it is ready to be deleted
Preloader Event Dispatch:
Progress
Indicates download progress
Complete
Indicates that the download is complete
Rslerror
Indicates that a runtime shared library could not load
Rslprogress
Indicates the download progress for a runtime shared library
Rslcomplete
Indicates that's download is complete for runtime shared libraries
Initprogress
Indicates that the application is initializing
InitComplete
Indicates that the application has initialized
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.