Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

10 Tips for Flex Application Performance

We're going to keep this post lean and mean, and get down to
business with 10 Tips that will keep your Flex applications fast, lean,
and responsive.
Rule # 1: Clean up after yourself
In general, it is good practice to maintain clean code. Not only
in the sense of having properly formatted and readable code, but also
code that leaves nothing behind... no memory leaks, no cpu hogs,
nothing but a clean object that can be reclaimed by the GC.
1) Manage your event listeners
- this message is
two fold. First, you should always remove event listeners that are no
longer needed. They can lead to object references that prevent the
garbage collector, which equates to memory leaks, which can be very
difficult to track down and detrimental to application performance. You
can use weakly referenced event listeners to minimize memory leakage,
but you still should explicitly clean them up when you don't need them
anymore. The second factor is that failure to remove event listeners
can cause performance issues. Event handlers could be firing within
your application, which you weren't even aware of. You dispatch an
event in a child component, and there could be handlers up the DOM tree
(parent objects) that are also firing on the same event. If you don't
want this to happen, be explicit with your event handlers; make them
handle specific event types, and get rid of them when your application
doesn't need them anymore.
2) Unload loaders
- any time that you are using an
object based on a loader (Image, SWFLoader, etc...), it's a good
practice to call unloadAndStop() to unload the content from the loader,
and invoke the GC. This will free up valuable system resources and cpu
cycles won't be wasted if they aren't needed. I typically even do this
for static image files, to prevent memory usage from creeping up.
3) Dispose of things
- I find it to be a very good
practice to create "dispose()" functions in your custom components,
data managers


Ïà¹ØÎĵµ£º

´´½¨Ò»¸öMap·þÎñ²¢ÔÚFlexÖе÷ÓÃ

Ò»¡¢    ½«±£´æmxdµØͼÎĵµµÄÎļþ¼ÐÉèΪ¹²Ïí£¬²¢¸øSOC,SOM,MANAGER£¬¹ÜÀíÔ±ÕË»§ÊÚËùÓÐȨÏÞ¡£
¶þ¡¢    ÔÚArcCatalogÖУ¬µã»÷connector to folder£¬½«ÉÏÃæµÄĿ¼Ìí¼Óµ½CatalogÖС£
Èý¡¢    ÔÚÄ㽨Á¢µÄGIS ServerÉÏÓÒ¼ü£¬Ð½¨Ò»¸ö·þÎñ¡£
1¡¢      Ó ......

flexѧϰ ×Ô¶¨Òåʼþ

ÎÒ¸öÈ˾õµÃÕâ¸ö×Ô¶¨Òåʱ¼ä·â×°ÐԺܺ㬵«ÊÇÓе㸴ÔÓ£¬²»½¨Òé¼òµ¥±à³ÌÖÐʹÓÃ
´´½¨Ò»¸öMXML×é¼þ£¬½¨×Ô¶¨Òåʼþ
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<!--[CDATA[
private function clickHandler():void{
// var m ......

»ùÓÚFlexµÄflv¼òÒײ¥·ÅÆ÷

×î½üÔÚÏîÄ¿ÖÐÒªÓõ½flv²¥·ÅÆ÷£¬ÓÉÓÚflex×Ô´øµÄVideoDisplay×é¼þ²»ÊǺܺÃÓ㬾Í×Ô¼º¼òµ¥ÊµÏÖÁËÒ»¸ö£¬½çÃæ²»ÊǺÜÃÀ¹Û£¬µ«¹¦Äܶ¼ÓÐÁË£¬Õý¿ÉνÂéȸËäСÎåÔà¾ãÈ«¡£ÏÂÃæÊDz¥·ÅÆ÷µÄ´úÂ룬»¹²»»áÓÃflash×öflv²¥·ÅÆ÷µÄÅóÓÑ£¬¿ÉÒԲο¼²Î¿¼¡£
Player.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="ht ......

ÀûÓôúÂëÓë²¼¾Ö·ÖÀë¼¼Êõ¹¹½¨×Ô¶¨ÒåFlex×é¼þ


XMLºÍActionScriptÔÚ´´½¨×é¼þ·½Ãæ¸÷ÓÐÓÅȱµã£º
ÔÚ´´½¨¸´ºÏ×é¼þʱ£¬MXML¿ÉÒÔʱ´´½¨¹ý³Ì±äµÃºÜÈÝÒ×£¬²¢ÇÒ·½±ãÓÚ¶Ô×ӿؼþ½øÐв¼¾Ö¡£
ÔÚÐÞ¸Ä×é¼þÐÐΪʱ£¬ÎÒÃÇ¿ÉÒÔÓÃActionScriptÀ´ÐÞ¸ÄËûÃǵķ½·¨¡£
´ó¶àÊýʱºò£¬ÎÒÃÇ»áʹÓÃMXMLºÍActionScript½áºÏµÄ·½Ê½À´´´½¨Flex×é¼þºÍÓ¦Óá£
FlexÌṩÁ˶àÖÖ·½Ê½À´½áºÏʹÓÃMXMLºÍActionS ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ