`

SystemManager: Every Flex application’s best friend

    博客分类:
  • Flex
 
阅读更多

SystemManager: Every Flex application’s best friend

When I first joined the Flex framework team, the Flex SystemManager seemed like a black magic, voodoo-y class that no one in their sane mind wanted to touch. In fact, the one time I did make a change to SystemManager (early in my development career), I inadvertently ended up pulling in all of UIComponent and bloating Flex development SWFs that week by a good 10k. Oops - good thing we have tests to check for mistakes like that.

Some time later, I started researching SystemManager in order to speak about it in one of my talks. I had an epiphany: SystemManager is not so scary. In fact, I’d go so far as to say that it is the most important class in the entire Flex framework.

So, let me try to make SystemManager less mysterious and explain how it enables the creation of Flex applications.

What does the Flex SystemManager do?

SystemManager is really the engine behind getting your Flex application up and running. Its most important job is creating the Application instance and adding it to the Flash Player display list. It also acts as the parent to all top-level items like popups, tooltips, and cursors in a Flex application. In addition to parenting them, SystemManager handles focus between these top-level items.

SystemManager creates my application? Tell me more….

This is what is so cool about SystemManager. There is a definite order to what happens the moment a Flex SWF is hit and it starts streaming down to a Flash Player client. Lets talk about that sequence of events.

First, it is imperative to understand that a Flex SWF is a 2-frame movie. The first frame of a Flex SWF contains the SystemManager, the Preloader, the DownloadProgressBar and some “glue” helper classes. Remember, the Preloader is what creates the DownloadProgressBar control which displays the progress of a Flex application downloading and being initialized. The second frame of a Flex SWF contains the rest of the Flex framework code, your application code and all of your application assets like embedded fonts, images, etc. By creating a 2-frame movie, Flex applications can take advantage of the streaming support built into the Flash Player and a preloader can appear before all of the Flex framework code and your application code are downloaded.

So, here’s the order of things once an mxml file or Flex SWF is hit. First, enough bytes for frame 1 are streamed down to the Flash Player. The Flash Player executes those bytes by creating a SystemManager instance. The first thing the SystemManager does is instruct the Flash Player to stop at the end of frame 1. The SystemManager then goes on to create the Preloader which creates the DownloadProgressBar control and pops that up on the client screen. The Preloader then starts tracking the rest of the bytes streaming in from the Flex SWF. Once all the bytes for the Flex framework and application code are in, the System Manager goes on to frame 2 and instantiates the Application instance.

Once the Application instance has been created, the SystemManager does a very important thing. It setsApplication.systemManager to itself. This is how you, the application developer, can access the SystemManager at a later time. After the systemManager property has been set on the Application instance, the Application goes on to create its children. Eventually, once all the Application child controls and containers have been created, sized and positioned, the Application dispatches thecreationComplete event. Once thecreationComplete event has been dispatched, the Preloader removes the DownloadProgressBar control and the SystemManager adds the Application instance to the Flash Player display list. (Aside - the Flash Player display list is basically the tree of visible or potentially visible objects that make up your application. When you add and remove child components to your application, your basically just adding and removing them from the display list).

Once the Application is added to the Flash Player display list, the Application dispatches itsapplicationComplete event and voila! The Application has been created and is up on the screen ready to be interacted with.

Phew - that was a mouthful, but hopefully it made sense. If you read over it a couple of times, you’ll see the execution of tasks once a Flex application is hit is very methodical.

分享到:
评论

相关推荐

    systemManager:后台管理系统

    "systemManager:后台管理系统"是一个专门针对系统管理的开源后台应用。这个项目旨在提供一个高效、易用且功能丰富的管理平台,使系统管理员能够轻松地监控、管理和维护各种IT资源。下面将详细介绍这个系统的相关知识...

    FLEX 系统管理器 SystemManager

    SystemManager不仅负责控制Flex应用的基本元素,如应用窗口、Application实例、弹出窗口和光标,还负责管理ApplicationDomain中的类加载和执行。下面将详细讨论SystemManager的主要功能和工作流程。 1. **应用窗口...

    SystemManager:系统管理员项目-开源

    这是用于检测和增强系统硬件的终极Java应用程序:RAM,CPU和所有这些东西!

    flex事件运行流程

    本文将深入探讨Flex事件运行流程,特别是与`mx:Application.applicationComplete`、`creationComplete`以及Flex应用程序初始化顺序相关的知识点。 首先,Flex应用程序的启动始于`preloader`阶段,系统管理器...

    Flex启动与初始化

    SystemManager 的 application:IUIComponent 属性引用载入 Flex 项目的 application 实例,getDefinitionByName(name:String):Object 方法获取载入 swf 中的定义,例如 Object(SystemManager(mySwfLoader.content)....

    Flex通讯系列---Flex与SWF(一)

    这里讲述的是在Flex Application中嵌套一个SWF,然后实现Flex与SWF相互间的通讯。我们需要引入SystemManager接口实现。 环境:Eclipse + Flex Builder

    Flex框架的基本原理.docx

    - `totalLevelSystemManager`属性:指向当前程序的SystemManager实例,如果Flex程序被嵌入,该属性将指向加载它的SystemManager实例。 - UIComponents的`systemManager`属性:每个组件都有一个指向SystemManager的...

    Flex等待鼠标的图标

    在Flex开发中,用户界面的交互性和用户体验是至关重要的,而图标则是提升这些元素的关键因素之一。"Flex等待鼠标的图标"是指在Flex应用程序中,当系统正在进行后台处理或者加载数据时,显示的一种特殊鼠标指针,通常...

    FLEX企业应用开发实战.part1

     3.2 Flex Application  3.2.1 SystemManager  3.2.2 Preloader  3.2.3 Application的作用和主要属性  3.2.4 通过SWFLoader加载Application  3.2.5 域及跨域访问  3.3 Flex Module  3.3.1 创建模块 ...

    FLEX企业应用开发实战.part2

     3.2 Flex Application  3.2.1 SystemManager  3.2.2 Preloader  3.2.3 Application的作用和主要属性  3.2.4 通过SWFLoader加载Application  3.2.5 域及跨域访问  3.3 Flex Module  3.3.1 创建模块 ...

    flex弹出另一个窗体

    1. **创建新的Application类**:首先,你需要创建一个新的Flex `MXML`文件,定义一个新的`Application`类。在这个类中,你可以添加所需的组件、事件监听器和其他功能。 2. **定义启动方法**:在新`Application`类中...

    flex 控件 全屏显示

    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="init()"> ``` 此部分声明了XML版本和编码,并定义了MXML命名空间。 2. **脚本定义**: ```xml <mx:...

    SystemManager介绍资料

    SystemManager是一款强大的服务器管理系统,专为IT管理员设计,旨在简化和优化数据中心的日常运维工作。在深入了解SystemManager之前,我们首先要明白服务器管理的重要性。在信息化社会,服务器是支撑企业业务运行的...

    理解Flex3的组件和框架的生命周期.doc

    Flex3 是 Adobe 开发的一种用于构建富互联网应用程序(RIA)的框架,它基于 ActionScript 3.0 和 Flash Player 或 AIR 运行时环境。在深入理解 Flex3 的组件和框架生命周期之前,我们需要先了解 Flex 的历史背景以及...

    SystemManager

    《SystemManager深度解析》 SystemManager,作为一个关键的系统管理工具,它在IT领域中扮演着举足轻重的角色。本文将深入探讨SystemManager的核心功能、工作原理以及其在实际应用中的价值,帮助读者理解并掌握这一...

    systemmanager

    华为手机,系统文件,安装后,手机可以用来为所欲为

    理解Flex3组件和框架的生命周期.pdf

    - **SystemManager**:Flex 应用程序的核心是 SystemManager,它负责协调各个组件和事件的处理。 - **初始化阶段**:在这个阶段,应用的主要元素被初始化,包括外部接口和其他配置设置。 - **预加载阶段**:预加载...

    如何学习flex,从0开始的

    - **管理器(Managers)**:Flex中的管理器执行特定任务,如SystemManager负责应用程序启动流程,StyleManager处理CSS样式和皮肤,DragManager支持拖放功能。理解这些管理器的工作原理对优化程序性能和实现复杂功能...

Global site tag (gtag.js) - Google Analytics