`

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:后台管理系统

    系统管理员后台管理系统

    FLEX 系统管理器 SystemManager

    SystemManager是Flex应用的主控者,它控制着应用窗口,Application实例,弹出窗口,cursors,并管理着ApplicationDomain中的类。SystemManager是FlashPlayer实例化的第一个类,它存储了主应用窗

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

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

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

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

    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 创建模块 ...

    systemmanager

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

    SystemManager介绍资料

    服务器管理SystemManager介绍资料

    Flex企业应用开发实战源代码

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

    SystemManager

    NULL 博文链接:https://ivan-yan.iteye.com/blog/900556

    datavisualization

    flex datavisualization advancedatagrid SystemManager/updateLastActiveForm

    NetApp OnCommand System Manager 3.1.2

    Data Ontap从8.2开始不能直接用浏览器来图形界面管理了,得下载NetApp OnCommand System Manager 是简单易用而又功能强大的 NetApp 存储管理工具。NetApp OnCommand System Manager 3.1.2

    播出视频服务器的安全运维.docx

    视频服务器配置管理 哈雷視频服务器需通过Systemmanager程序进行配置管理,程序安装在本地PC工作站,通过管理程序可进行视频服务器的配置管理、状态警报查看等,视频服务器配置包括:设置IP地址、基本参数配置、配置...

    Android知识体系思维导图

    Android知识体系思维导图 1、androidmanifest.xml 2、UI 3、多线程 4、进程 5、工具类 ...7、SystemManager 8、Activity 9、Service 10、BroadcastReceiver 11、ContentProvider 12、Intent

    OnCommand System Manager 2.0.rar

    通过该公司的OnCommand管理工具可以同时管理NetApp和其他第三方企业级存储。OnCommand性能管理解决方案提供Data ONTAP集群环境的检测和故障排除。

Global site tag (gtag.js) - Google Analytics