Is there a way to catch a MOUSE_UP Event over a static textfield in Flash?
Posted
by Jovica Aleksic
on Stack Overflow
See other posts from Stack Overflow
or by Jovica Aleksic
Published on 2010-05-07T23:02:58Z
Indexed on
2010/05/07
23:08 UTC
Read the original article
Hit count: 297
When the user presses the mouse, and releases it over a static textfield with selectable text, no MOUSE_UP event is fired - not on the stage and also nowhere else.
I experienced this when using a scrollbar class on a movieclip with a nested static textfield. When the user drags the scroll handle and releases the mouse over the textfield, the dragging/scrolling is stuck.
To test this, create a new AS3 fla file, place a static textfield somewhere, and put in some text. Make sure the selectable property is checked in the properties panel. Add this script to the timeline:
import flash.events.*
function down(event:Event):void { trace('down'); }
function up(event:Event):void { trace('up'); }
stage.addEventListener(MouseEvent.MOUSE_DOWN, down)
stage.addEventListener(MouseEvent.MOUSE_UP, up)
Now test the movie and click the mouse. You will notice that trace('up') will not occur when you release the mouse over the textfield.
© Stack Overflow or respective owner