A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [F8] Adding text before and after selected text in textbox

  1. #1
    Senior Member
    Join Date
    Oct 2008
    Posts
    227

    [F8] Adding text before and after selected text in textbox

    hi.. I have really no idea how to do this, but i have a textbox and a button.
    When this button is clicked, i want it to add "<b>" before the currently selected text in the textbox. How would i go by this?
    Thanks

  2. #2
    Senior Member
    Join Date
    Oct 2008
    Posts
    227
    PHP Code:
    inputText.onKillFocus = function() {
    _root.onEnterFrame null;
    trace(this.text.substr(this.selected_text.split(",")[0], this.selected_text.split(",")[1]));
    inputText.setTextFormat(this.selected_text.split(",")[0], this.selected_text.split(",")[1], myTextFormat);
    };
    var 
    newTextFormat = new TextFormat();
    newTextFormat.bold true;
    inputText.onSetFocus = function() {
    setBold.onRelease = function() {
    begin Selection.getBeginIndex();
    end Selection.getEndIndex();
    inputText.setTextFormat(begin,end,newTextFormat);
    trace(begin);
    trace(end);
    };
    }; 
    I have something of a test here to see if i could add Bold to the selected text. But cant even get that working

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center