A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: to select and make bold with HTML text...

  1. #1
    Senior Member Vincent26381's Avatar
    Join Date
    Feb 2003
    Location
    The Netherlands
    Posts
    833

    to select and make bold with HTML text...

    Hi,

    I'm trying to make a text editor in flash but I'm having way too much trouble with it (my scripting is just too bad I guess)

    What I'm trying to do is a 'bold' button. With this button I want selected text to be bold; if no text is selected I want the text that is inserted after 'bold' to be bold (sounds confusing but the same way as for example MS Word)

    What I have now is this:

    'bold' button:
    code:

    on(rollOver){
    startSel = Selection.getBeginIndex();
    endSel = Selection.getEndIndex();
    oudeSelectie = Selection.getFocus();
    if (endSel - startSel > 0){
    selected = "true";
    } else {
    selected = "false";
    }
    }

    on (release) {
    if (selected eq "true"){
    Selection.setFocus(oudeSelectie);
    Selection.setSelection(startSel,endSel);
    begin = tfield.slice(0,startSel);
    z= tfield.slice(startSel,endSel);
    end = tfield.slice(endSel,1000000);
    output= begin add "<B>" add z add "</B>" add end;
    tfield = output;
    }
    Selection.setFocus("textfield.text");
    Selection.setSelection(100000,100000000);
    }



    When HTML formatting is set off to in the textfield it seems to work fine but as I turn it on all text is gone after selecting and pressing the button.

    If I make trace 'output' I see a long string of HTML tags plus the two tags for bold but the bold tags(<b></b>) are at the wrong place.

    Is there any way to go this way with HTML formatted text?

    I would be most greatfull
    (and happy)

    Thanks,

    Vincent
    Last edited by Vincent26381; 07-31-2003 at 02:55 PM.

  2. #2
    Senior Member devnull_2k's Avatar
    Join Date
    Oct 2001
    Location
    Limehouse, Ontario - Never heard of it? Not surprised.
    Posts
    785
    Don't use bold tags. Use the TextFormat object
    The future belongs to those who prepare for it today.

  3. #3
    Senior Member Vincent26381's Avatar
    Join Date
    Feb 2003
    Location
    The Netherlands
    Posts
    833
    Hi,

    Thanks for your reply.
    Could you please explain?;
    I'm working on this

    Can I use the TextFormat for that?
    Can one textfield have more textformats?

    Thanks,

    Vincent
    Vincent
    SWIS BV

    Last edited by Markp.com on 07-23-2003 at 02:25 AM

  4. #4
    Senior Member Vincent26381's Avatar
    Join Date
    Feb 2003
    Location
    The Netherlands
    Posts
    833
    sorry to bumb this

    Please?
    Vincent
    SWIS BV

    Last edited by Markp.com on 07-23-2003 at 02:25 AM

  5. #5
    Senior Member Vincent26381's Avatar
    Join Date
    Feb 2003
    Location
    The Netherlands
    Posts
    833
    I hate to bumb this again but nobody looks at the second page
    Is there any one able to help me out?
    Vincent
    SWIS BV

    Last edited by Markp.com on 07-23-2003 at 02:25 AM

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