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

How to start the Flex application

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

Share

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

This article mainly introduces how to start the Flex application, 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 know about it.

Flex application startup

Writing a simple Flex application is not complicated, even if you have never been involved in Flex programming, it does not take you long to make a beautiful and simple Mini Program, following the example steps to help. However, with the deepening of Flex programming, more and more people will feel that it is not easy to write a good Flex application. It involves all aspects of knowledge and needs to master the architecture of Flex application, the handling of event mechanism, the combination of design and program, and so on.

The content of this section starts with the startup and operation of the Flex application. In addition, Flex applications are generally event-driven, so when you learn all aspects of Flex, you should always think from an event-driven point of view.

As we all know, when we write Flex applications, we usually start with tags. In fact, when Flex applications start to run, they don't run directly from Application, and some of them run quietly before that. As you can see, when we run a written Flex application, although we don't write any code related to the startup progress loading bar, there is no exception. The application will automatically add this part for us. That's why we see the standard Flexloading loading bar shown below (in the next article, we'll change this stereotyped load bar to create a custom loading effect).

◆ what we usually call Flex applications are essentially Flash applications based on the Flex framework and written in ActionScript3.0, which is no different from ordinary Flash applications from this point. Relatively speaking, the traditional use of FlashIDE (such as FlashCS3) to create Flash programs is more based on the concept of "timeline" (Timeline) and "Frame", which is easier for designers to understand; while Flash applications based on Flex framework are more procedural, rarely mention the concepts of "timeline" and "frame", and are easier for programmers to understand. In fact, Flex applications also have timelines, but this part is hidden by the Flex framework and is usually not familiar to everyone. When creating Flex programs by default, Flex has already done all this for us, but understanding this part is more helpful for us to have a deeper understanding of the startup of Flex applications, so that we can control and play the program more flexibly.

Let's take a look at the diagram above. The Flex application consists of two frames, the first frame is the preloader part, and the second frame is the main application part, which is managed by the root SystemManager of the Flex application, SystemManager is a subclass of flash.display.MovieClip, and the movie clip (movieclip) supports frames. Because swf is a progressive download format, it is precisely because of the swf format that FlashPlayer does not need to wait for the entire program to download before directly accessing the contents of loaded frames. Therefore, * frames are usually used as loading display when the application is loaded. Generally speaking, * frames should contain as little content as possible (try not to include components of the Flex framework in * frames). So that it can be downloaded quickly and displayed immediately. The second frame is the real content of the main application. Once the SystemManager instance enters the second frame, it begins the life cycle of the internal main application (lifecycle), that is, the part that we are most familiar with. (the SystemManger instance has an application property, which is null at frame 1, and points to the real main program application instance when frame 2 is entered.)

◆ Note: frames are a basic unit of the timeline, such as the PAL TV system, 25 frames per second, while movies usually have 24 frames per second, which is actually similar to the concept of frames in Flash. Remember what we said at the beginning, Flex applications are generally event-driven.

After the program enters frame 2 and the main program application starts to run, a series of events will be triggered accordingly, which will be introduced in the order in which the events occur:

Preinitialize

The application application has been instantiated, but no related child components (childcomponen) have been created at this time

Initialize

At this point, the corresponding child components have been created, but these child components have not yet been laid out

CreationComplete

The application application completes all instantiation and completes the layout of all subcomponents

ApllicationComplete

The completion of the above three events in ◆ indicates that the entire process started within application is complete, and then SystemManager is notified to dispatch applicationComplete events. At this point, the launcher is complete and ready to run.

Run the following Mini Program to understand these events again, and note that since no subcomponents have been created when the preinitialize event is generated, the corresponding displayed string cannot be assigned directly to the TextArea component display in the handler of this event.

Thank you for reading this article carefully. I hope the article "how to start Flex applications" 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