Pay for Hesitation: Notes for the Mouse Event

Pages

2010年3月4日 星期四

Notes for the Mouse Event

1. preventDefault()
有些元件有預設的behavior, 如simpleButton, 就有預設對應MouseEvent.OVER 的behavior, preventDefault可以關掉這種預設行為.

2. In AS3 , 沒 right click event.

3.當有多個interactiveObject overlap時, Flash player只會trigger 視覺上最上層那個物件的mouse event.

4.承上, 所以一個sprite 上若有textField, 那麼滑鼠點到textField時, sprite會收不到event. 解決的辦法是textField.mouseEnable = false;

5.取得mouse座標有兩種方法
.localX 與.localY, the position which relative to the event target's top left corner
.stageX 與.stageY, the position in the Stage instance.

6.Mouse.hide() //hide the system mouse pointer
Mouse.show() //show the system mouse pointer

7.若要設置flash player空白處的Mouse Event, 就必須在Stage instance註冊listener, 但是某些security的原因, 可能會被阻擋存取stage, 解決方法請參essential as3 的Ch12 的Handling Events Across Security Boundaries.

沒有留言: