Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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


Ïà¹ØÎĵµ£º

¹ØÓÚflexÐÔÄܵ÷ÓÅÏà¹ØµÄһЩ×ܽá

1.Performace°üº¬4µã£º
£¨1£©Latency·´Ó¦Ê±¼ä£¨2£©Scalability:¿¹Ñ¹ÄÜÁ¦£¨3£©Reliablity£ºÎȶ¨ÐÔ£¨4£©Availability£º¿ÉÓÃÐÔ
2.ÔËÐÐʱÉúÃüÖÜÆÚ£º
FlexÖ»ÓÐÁ½Ö¡frames£ºPreload frame ºÍ application frame¡£
ÿһ¸öflex application ÊÇÒ»¸öMovieClip£¬ÒòΪÿ¸öflex application¶¼ÓÐSystemManager£¬ËûÊǼ̳Ð×Ô
flash.dis ......

Flexʼþ»úÖÆ

Flexʼþ»úÖÆ
Flexʼþ»úÖÆÊǹ۲ìÕßģʽ£¬¼´Ê×ÏÈҪע²áʼþ£¬Ê¼þ·Ö·¢ºóͨ¹ýʼþÏìÓ¦º¯Êý½øÐд¦Àí¡£
ÀýÈçÔÚAS3ÖУº
button.addEventListener(“click”,onClick);//Ïòbutton×¢²áÒ»¸öclickʼþ
internal function onClick(evt:MouseEvent):void{txt.text=“click a button!”;}//ʼþÏìÓ¦º¯Êý
ÄÇÃ ......

Flex Óà POST Ìá½»Êý¾Ý


public function submit():void{
   
    //ÒªÇëÇóµÄURL
    var request:URLRequest = new URLRequest("
http://localhost:8086/test.do
") ;
    var load:URLLoader = new URLLoader() ;
    //URL²ÎÊý
  & ......

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 Deep Link(ÉîÁ´½Ó)Ó¦ÓÃ


×î½ü×öÓÎÏ·µÄʱºò£¬·¢ÏÖÍ˳öµÇ½ʱURLÉÏ»á×Ô¶¯¼ÓÉÏÒ»¸ö“#”×Ö·û£¬ºÜÆæ¹Ö£¬Google+BaiduÎÞÊý´Î¶¼Ã»ÓÐÕÒµ½´ð°¸¡£½ñÌìÎÞÒâ¼ä¿´µ½¼¸¸ö
ȺÓÑÔÚ˵ͨ¹ý“BrowserManager”»ñÈ¡URL£¬ÓÚÊÇ×Ðϸ²é¿´ÁËAPI£¬ÓÖ·¢ÏÖÁË“HistoryManager”£¬Õâ¸öÎÊÌâÖÕÓÚÃ÷°×ÁË¡£
ÎÒÃÇͨ³£¿´µÄWebÒ³Ãæ
¿ÉÒÔͨ¹ýä¯ÀÀÆ÷µ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ