This link may help out a bit... <http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary635.html>
"Selection class Availability Flash Player 5.
Description
The Selection class lets you set and control the text field in which the insertion point is located; that is, the field that has focus. Selection-span indexes are zero-based (for example, the first position is 0, the second position is 1, and so on).
There is no constructor function for the Selection class, because there can only be one currently focused field at a time."
here are a few useful functions of the current selection:
"Selection.getBeginIndex()
Returns the index at the beginning of the selection span. Returns -1 if there is no index or currently selected field.
Selection.getCaretIndex()
Returns the current caret (insertion point) position in the currently focused selection span. Returns -1 if there is no caret position or currently focused selection span.
Selection.getEndIndex()
Returns the index at the end of the selection span. Returns -1 if there is no index or currently selected field."
Just make sure that the proper text field has focus and these should work.
Lingo is a little simpler though, as James pointed out, but then again, it was designed to be easier to do stuff like this.
On a side note, I have started looking at Python, and I am finding its way of coding very comfortable, fast, fairly easy, and it reminds me of lingo!
HTH, ~Mathew
Matt Wells wrote:
Ok so if replaceSel(text) will replace the selection that is selected
then is there a way to get what is selected?
So I select Matt form the sentence below:
Hello my name is Matt?
I need to get Matt and add the <b></b> tags to get <b>Matt</b>
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mathew Ray Sent: Wednesday, June 16, 2004 3:09 PM To: [EMAIL PROTECTED] Subject: <lingo-l> <lingo-l>Text question
Not to say you shouldn't use Director, but is shockwave -may- not be the
best tool for the job...if all you are looking for is text handling of input selection, flash can definitely do that.
First Question: Have you tried using the custom text formatterstuff and the Selection class in flash? It has worked for me in the past (Flash6+).
replaceSel() can replace the current selection with new text, but it won't re-render the look if it is an html field. my_txt.replaceSel(text);
Otherwise look at using the Selection class to get the in and out point of the selection and re-apply the text to the string.
[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
