Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


How to automatically deselect a selected text in a selectable textarea

Posted on 2003-10-24
Medium Priority
Last Modified: 2009-12-16
Hi there

I' ve got a selectable textarea
I would like that when  I release the mouse button after selecting a text, the text is automatically deselected...

do you know how to do it??

Question by:BRX
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3

Accepted Solution

Calron earned 150 total points
ID: 9617954
Here's a method that works:

listener = new Object();
listener.onMouseUp = function() {
      if (Selection.getFocus() == "_level0.txt") {
            Selection.setSelection(Selection.getCaretIndex(), Selection.getCaretIndex());

instead of "_level0.txt" you will have to put in the path to your own textfield (to find out what the exact path is, use this method:

listener = new Object();
listener.onMouseUp = function() {
      trace (Selection.getFocus());

then click in your textfield and the path will print out.

You still have one problem here, you can still select text by using shift - arrow button, but at least the selecting with the mouse will be stopped.

Expert Comment

ID: 9617956
Oh, just a side mention, this code is tested on Flash MX, it probably won't work on pre Flash MX

Expert Comment

ID: 9625802
Thanks for the points, just a question, why the B grade? It's not that I want you to change the grade, I would like to know what was missing for an A so at a next time I can provide the missing bit as well ....

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question