Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Why Flex Modularization

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces why to Flex modularization, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

1: why Flex Modularization

Flex modularization provides separation of application code into different swf files to reduce download time and file size. The benefits of using Modules are:

1. You don't need to download modules immediately when the main application starts. The application loads and unloads modules as required.

two。 Because each modules is independent of the other application modules, when you need to change a modules, you only need to recompile the modules instead of the entire application.

Flex modularization can create Flex modular applications is an important aspect of improving the performance of the Flex framework, providing more ability to control download time and file size. With modules, you can separate application code based on which can be loaded independently and which can be used by other programs.

2: how to Flex Modularization

2.1Create Flex module

Mxml-based module, right-click on your project-> new- > mxmlModule

As-based module

Package {importmx.modules.Module; publicclassGeneralextendsModule {publicfunctionGeneral () {super ();}

2.2 load Flex module

2.2.1 loading using ModuleLoader

2.2.2 loading using ModuleManager

PrivatefunctioncreationHandler (): void {_ moduleInfo= ModuleManager.getModule ('ContactList.swf'); _ moduleInfo.addEventListener (ModuleEvent.READY, moduleLoadHandler); _ moduleInfo.load ();} PrivatefunctionmoduleLoadHandler (evt:ModuleEvent): void {canvas.addChild (_ moduleInfo.factory.create () as DisplayObject);}

2.2.3 create a pop-up Flex module

Vargeneral:ModuleLoader general=ModuleLoader (mx.managers.PopUpManager.createPopUp (this,ModuleLoader)); general.url= "General.swf"

Note: when creating a pop-up module, there is sometimes an error that cannot convert mx.managers::PopUpManagerImpl@bba9941 to mx.managers.IPopUpManager, so we need to introduce it into the main program.

Importmx.managers.IPopUpManager; privatevaripopUp:IPopUpManager thank you for reading this article carefully. I hope the article "Why Flex Modularization" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report