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
相关文档:
1.弹出新窗口
Flex通过PopUpManager类来实现弹出新窗口:
先设置好要弹出窗口的页面,然后在主窗口中先new出弹出窗口的对象,然后可以对弹出窗口的属性进行
赋值,
var genggai : GengGaiWindow = new GengGaiWindow();
genggai.logId = adg.selectedI ......
public function submit():void{
//要请求的URL
var request:URLRequest = new URLRequest("
http://localhost:8086/test.do
") ;
var load:URLLoader = new URLLoader() ;
//URL参数
& ......
Flash/Flex也支持基于Socket的网络连接 ,服务器端可以是C++,VB,C#,Java等任一语言开发。监听一个网络端口便可以接收到Flash/Flex开发的客户端的连接。
ActionScript 3.0提供了通过Socket连接的方式与服务器端通信。这点是超越传统B/S结构的重要特征。这样使得网 ......
<?xml version="1.0" encoding="utf-8"?>
<s:Application name="Spark_NumericStepper_textInput_editable_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xml ......