Previously, Flex performance optimization

xiaoxiao2021-03-06  49

name

Flex

performance

Improve performance

Avoid multi-layer nested containers

A good experience is to avoid the nesting of the container more than three layers.

Fill unwanted blank with Spacer objects

Absolute positioning and zoom

Calculation of each container and its sub-object size and location takes up a large number of resources

Object location fixed coding

Use the Canvas container, other types of containers (such as VBOX) cannot use absolute positions

Secure the object width and height

The processing load of the relative layout manager can be reduced, thereby accelerating the creation of containers and controls.

Avoid common container redundancy

VBOX container in the tag

VBOX in the label

The container can be discarded as the top label of the MXML component.

Unnecessary VBOX containers out of the MXML component to set some styles, you can set the style on the component

Re-evaluation of the selection of containers

Improve performance experience

Postponed instantiation

Can be used when you don't have to display a screen display

The navigation bar container (Viewstack, Accordin, Tabnavigator) has been delayed, and the default delay is delayed

CreationPolicy = "auto, all, none"

Gamble layout

Need a screen display, but the redraw is low-efficient

Get good performance in the running time (not suitable)

Note: Don't use the setStyle () method for the first time.

Style use

block (as an explicit attribute of the MXML tag)

External CSS style sheet, (global style)

data service

Flash safety sandbox

Due to the presence of the Flash Player Safety Sandbox, requests for web services can only be used to load SWF files.

Use a proxy (not in the same host or domain)

UseProxy = "true" attribute directly calls the service.

Do not use the agent (in the same host or domain)

UseProxy = "false" attribute directly calls the service. Terminal Services must have a crossdomain.xml file.

The best transmission data method for both performance is the use of HTTPService XML and RemoteObject using AMF.

Web service agent

Remote object agent

HTTP service

Implement

Pre-compilation MXML page

The pre-compiled application can also make developers distribute non-source applications.

Flex

1. See some functions in the original class in mx.swc

2. Cellrenderer, Labelfunction

View Cellrenderer API

3.Effect Use change display effect

MouseDowneffect

MouseoveReffect

Mouseupeffect

Moveeffect

Resizeeffect

SHOWEffect

Mouseouteffect

Hideeffect

3. Other tricks to see Flexbook

JavaScript

1. Use GetURL directly to use JavaScript

Open full screen window

GETURL (JavaScript: Void (Window.Open ('Test.mxml', 'NewWindow', 'Fullscreen = YES, TYPE = FullWindow, Scrollbars = NO, Directories = NO, STATUS = NO, MENUBAR = NO')))));

Close the current window (no prompt is closed)

GetURL (JavaScript: window.comNer = 'DSG'; window.close (););

2. Add JavaScript in the generated HTML file, use JavaScript through geturl

转载请注明原文地址:https://www.9cbs.com/read-85159.html

New Post(0)