Solved

How to automatically deselect a selected text in a selectable textarea

Posted on 2003-10-24
3
355 Views
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??

BRX
0
Comment
Question by:BRX
[X]
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
3 Comments
 
LVL 5

Accepted Solution

by:
Calron earned 50 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());
      }
}
Mouse.addListener(listener);


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());
}
Mouse.addListener(listener);

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.
0
 
LVL 5

Expert Comment

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

Expert Comment

by:Calron
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 ....
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
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.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

734 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