Solved

How to automatically deselect a selected text in a selectable textarea

Posted on 2003-10-24
3
352 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 …
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
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 what frame rate is, how to control it and what effect it has on the video.

756 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