![](/img/trans.png)
[英]Embed SWF wmode opaque Actionscript 3 event Mouse.Down event weird behaviour
[英]wmode=“opaque” causes selection on textarea to behave wierdly after mouse is pressed and left stage
我在Flash 10 CS5 AS3中使用textarea。 問題是,當我嘗試選擇文本並退出舞台並離開鼠標,然后再次在文本上移動鼠標時,文本的選擇將隨鼠標一起移動。
原因如下:
* click somewhere on the text and drag the mouse in order to select the text
* then go out of the swf
* leave the mouse
* now move mouse on textarea
->文本選擇將隨鼠標移動...
如何停止這種行為????
我嘗試在舞台上實現mouseleave,但問題是當鼠標按下並離開舞台時,無法檢測到mouseleave事件。
這是因為wmode =“ opaque”參數。 我發現當wmode =“ window”時它不會執行此操作。 有解決方案嗎?
如果您使用的是TLF TextField,並且事件已附加到TextField,並且a是TextField的名稱,請嘗試以下代碼
import flash.events.MouseEvent;
a.addEventListener(MouseEvent.MOUSE_DOWN , startdrag);
stage.addEventListener(MouseEvent.MOUSE_UP, stopdrag);
function startdrag(evt:MouseEvent):void
{
a.startDrag(true);
}
function stopdrag(evt:MouseEvent):void
{
a.stopDrag();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.