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与Spring集成后(BlazeDS 与Spring集成指南 ),第一个面临的问题就是:对于Java端返回的各种Java类型的对象,Flex中能否有相应的数据类型来映射。
处理,尤其是List、Set、Map及POJO对象值。
在 BlazeDS 与Spring集成指南 例子的基础上,调整相关的测试代码如下:
1、Java端
1.1、com.yeeach.HelloWorldService ......
Flash/Flex也支持基于Socket的网络连接 ,服务器端可以是C++,VB,C#,Java等任一语言开发。监听一个网络端口便可以接收到Flash/Flex开发的客户端的连接。
ActionScript 3.0提供了通过Socket连接的方式与服务器端通信。这点是超越传统B/S结构的重要特征。这样使得网 ......
我个人觉得这个自定义时间封装性很好,但是有点复杂,不建议简单编程中使用
创建一个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 ......
最近在项目中要用到flv播放器,由于flex自带的VideoDisplay组件不是很好用,就自己简单实现了一个,界面不是很美观,但功能都有了,正可谓麻雀虽小五脏俱全。下面是播放器的代码,还不会用flash做flv播放器的朋友,可以参考参考。
Player.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="ht ......
<?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 ......