ActionScript 3 开发的几个注意点

1、MouseEvent在某些时候要记得运行MouseEvent.updateAfterEvent();方法。

主要表现在拖动的时候。如果不执行该方法,会有延迟,比如拖动会有延迟。

2、某些时候要记得stopImmediatePropagation(参考:做个笔记Event的stopImmediatePropagation和stopPropagation方法)

主要表现在单击某元素的时候,不希望这个click操作到达下一层。因为stopImmediatePropagation立即进行了事件冒泡。防止对事件流中当前节点中和所有后续节点中的事件侦听器进行处理。

3、同AJAX一样,多次请求一个动态页面请加个时间戳,防止缓存。


var date:Date = new Date();
xmlLoader.load("xml.aspx?datestamp="
+date.getMilliseconds());//xmlLoader是我自己的类,继承了Loader类。

4、Flex中使用TitleWindow时如果要通过代码控制CloseButton按钮记得使用invalidateDisplayList();方法

(参考:使用代码控制TitleWindow的showCloseButton的奇怪问题),它其实实现的是mx.core.UIComponent的updateDisplayList()方法。但是不可能直接使用该方法。

Help中是这么写的:
Draws the object and/or sizes and positions its children. This is an advanced method that you might override when creating a subclass of UIComponent.

You do not call this method directly. Flex calls the updateDisplayList() method when the component is added to a container using the addChild() method, and when the component’s invalidateDisplayList() method is called.

If the component has no children, this method is where you would do programmatic drawing using methods on the component’s Graphics object such as graphics.drawRect().

If the component has children, this method is where you would call the move() and setActualSize() methods on its children.Components may do programmatic drawing even if they have children. In doing either, you should use the component’s unscaledWidth and unscaledHeight as its bounds.

It is important to use unscaledWidth and unscaledHeight instead of the width and height properties.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值