0

我在 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" 时它不会这样做。有解决方案吗?

4

1 回答 1

0

如果您使用的是 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();
}
于 2010-10-12T03:56:18.543 回答