Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Desktop, Mobile and non-browser Environments > AIR (Apollo)

Reply
 
Thread Tools Rate Thread Display Modes
Old 02-01-2008, 08:26 AM   #1
da98ofm
Registered User
 
Join Date: Oct 2006
Posts: 7
Default Override default text drag behavior of TextArea

In AIR, you can drag selected text and drop it into the same TextArea or into another TextArea (Or even outside of the AIR window). I would like to override or prevent this behavior, but I have not yet found a way.
It seems that this behavior is embedded in the TextField object.

Is there anyone that can point me in the right direction?
da98ofm is offline   Reply With Quote
Old 02-05-2008, 05:41 PM   #2
xwielder
Senior Member
 
Join Date: Aug 2007
Location: NE Ohio
Posts: 524
Send a message via AIM to xwielder
Default

This behavior is not specific to AIR. What you could do is just make the text non-selectable. But to have it selectable AND not dragable, I don't think is possible. I'll try some tests.
xwielder is offline   Reply With Quote
Old 02-05-2008, 05:49 PM   #3
xwielder
Senior Member
 
Join Date: Aug 2007
Location: NE Ohio
Posts: 524
Send a message via AIM to xwielder
Default

Okay, correction: it IS specific to AIR.

...working on solution, i'll get back to you.
xwielder is offline   Reply With Quote
Old 02-05-2008, 06:11 PM   #4
xwielder
Senior Member
 
Join Date: Aug 2007
Location: NE Ohio
Posts: 524
Send a message via AIM to xwielder
Default

Well, here's an idea. See what you can get from it.

ActionScript Code:
tf1_txt.addEventListener(MouseEvent.MOUSE_DOWN, listen); tf1_txt.addEventListener(MouseEvent.MOUSE_UP, noListen); var myMouseX:Number = 0; var myMouseY:Number = 0; function listen(event:MouseEvent):void {     myMouseX = this.stage.mouseX;     myMouseY = this.stage.mouseY;     tf1_txt.addEventListener(MouseEvent.MOUSE_MOVE, mover); } function noListen(event:MouseEvent):void {     tf1_txt.removeEventListener(MouseEvent.MOUSE_MOVE, mover); } function mover(event:MouseEvent):void {     trace("Aha!  Caught you!"); }

You'll just create two input text fields, tf1_txt and tf2_txt. Enter some data in the first text field (tf1_txt) then try to select and drag it to the second (tf2_txt).
xwielder is offline   Reply With Quote
Old 02-06-2008, 09:03 AM   #5
da98ofm
Registered User
 
Join Date: Oct 2006
Posts: 7
Thumbs up Thanks

Thanks for your input.

And you were in fact right initially when you claimed this not to be specific to AIR; this behaviour has been there all the time if the code was running in the Safari web browser (or so I've been told by Mac users).

Eventually we solved it with a bit of a hack: We pick up the nativeDragDrop event and set the text of the target area back to what it was before the dragged text was dropped onto it. This does not prevent the user from dragging and dropping text but it at least prevents the effects from that action.
da98ofm is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
calling a PDF file in Flash AudryLucy Projectors and CDs 20 12-30-2006 02:43 PM
textArea Html Default Tags LeahSmart Components 0 03-03-2006 12:14 PM
Disappearing Text From TextArea Component linsula Components 0 06-15-2005 02:27 PM
textArea component not scrolling all the text frank grimes Components 4 04-15-2005 12:19 AM
textarea, method to make the scrollbar auto-indent text, when no scrollbar present 303 maddec Components 0 01-04-2005 07:48 PM


All times are GMT. The time now is 10:47 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.