-
Senior Member
replaceSel can't get it to work
Hi,
After a lot of searching I'm still unable to replace text that is selected. I want to use this for a sort of word-processor. With HTML formatted text I hope then to be able to make buttons for bold, italic and underlined text. (select; press button > bold)
What I have found is this:
(input textfield has the var name 'TextBox')
button:
code:
on(rollOver){
startSel = Selection.getBeginIndex();
endSel = Selection.getEndIndex();
oldSelection = Selection.getFocus();
if (endSel - startSel > 1){
selected = "true";
}else{
selected = "false";
}
}
on (release) {
if (selected eq "true"){
Selection.setFocus(oldSelection);
Selection.setSelection(startSel,endSel);
TextBox.replaceSel("new text");
}
}
With this code the selected text stays selected after pressing the button (that's good) but nothing will be replaced
Any-one out there able to help me?
I would be most greatfull
Vincent
SWIS BV
Last edited by Markp.com on 07-23-2003 at 02:25 AM
-
Senior Front End Developper
not sure why your don't work... I copy paste and it worked fine. Don't use textBox as a instance name.
this is also working fine
code:
test_txt.text = "Hello World! This is original!!";
Selection.setFocus(test_txt);
Selection.setSelection(6, 11);
test_txt.replaceSel("Vincent");
-
Senior Member
Finally got it to work with your example.
I don't know why it didn't work at the first time though.
Thanks a ton!
Vincent
SWIS BV
Last edited by Markp.com on 07-23-2003 at 02:25 AM
-
Senior Member
I spoke to soon
With this HTML formatting get's lost (as stated in flash-help)
Do you know how this is done?
Vincent
SWIS BV
Last edited by Markp.com on 07-23-2003 at 02:25 AM
-
That links is pretty cool....did you ever figure it out. I'm attempting to do something very similar. Thanks!
We live in an engaging world - now get ready for an ingaging one.
-
free-webmaster-resource.com
hi, use htmlText instead of text and your html formatting should be there
-
Senior Member
Pretty old thread
look here
Vincent
SWIS BV
Last edited by Markp.com on 07-23-2003 at 02:25 AM
-
free-webmaster-resource.com
hehe,
-
This is pretty cool! Thanks.
We live in an engaging world - now get ready for an ingaging one.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|