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 use Flex Modularization

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

Share

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

This article will explain in detail why to use Flex modularization, the editor thinks it is very practical, so share it for you to do a reference, I hope you can get something after reading this article.

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.

two。 How to modularize Flex

2.1 create a module

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

As-based module

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

Load module in 2.2Flex modularization

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 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 on "Why to use Flex modularization" this article to share here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.

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