Flex dynamic code loading (swc swf)

Source: Internet
Author: User

Introduction:I believe that most flexer will explore how to load code more flexibly and dynamically after writing code for a period of time. This article is to solve this problem and learn and make progress together with everyone.
Note:So far, the flex program cannot dynamically load SWC files. It can dynamically load SWF files.
Purpose:Dynamic Loading of code reduces the size of the winner program and faster download. You can flexibly load different codes as needed. Multiple relatively independent parts can be divided with little coupling. And so on
Step by step:
1. Create a new Flex project, write code, and complete the module test.
2. Create a new Flex lib project projectswc, and SRC points to the project. Build successfully. Generate projectswc. SWC as the project Lib.
3. Right-click Project-properties-Flex build path-library Path-projectSwc.swc-double-click link type-select rslmodel -generate projectswc.swf.
4.this generated projectswc.swf can be dynamically called. Condition: 1. the full path of the class must be passed in. 2 interfaces are pre-defined, such as invoke (Object: object ).
5. The call process is similar to reflection in Java. It loads SWF with loader, loads classes with getdefinition, and finally calls invoke. Complete Dynamic call.
Summary:
There may be some details in the step by step process. I hope you can explore it yourself. If you have any questions, you can come up and discuss them together.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.