A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Colouring certain words in a textfield

  1. #1
    Great, Daddy-O! Hippyscum's Avatar
    Join Date
    Feb 2002
    Location
    Pays-Bas
    Posts
    382

    Colouring certain words in a textfield

    Hey folks, I was wondering if something like this was possible

    I'd create a textfield, and in another layer I add buttons I put over certain words in the textfield

    and then via actionscripting I address these words, and dynamicly give these words a diffrent color (mouseover effect)

    for instance:
    on mouseover
    textfield.word "blabla" color #111111

    hope its a bit clear and thanks =)
    lalalalalalala

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    if using buttons, why not put text in button frames
    ie ..
    "up" frame - blabla - black text
    "over" frame - blabla - red text

  3. #3
    Great, Daddy-O! Hippyscum's Avatar
    Join Date
    Feb 2002
    Location
    Pays-Bas
    Posts
    382
    well because I was planning to only use the 'hit' state so I could reuse 1 button over and over, and it saves me the button positioning in the text area's. sorry should have added that.
    lalalalalalala

  4. #4
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    you probably have to go the movieclip and positioning route
    Last edited by a_modified_dog; 12-23-2007 at 09:41 AM.

  5. #5
    Great, Daddy-O! Hippyscum's Avatar
    Join Date
    Feb 2002
    Location
    Pays-Bas
    Posts
    382
    [edit] thats almost it, but I kinda wished it was possible the actual text in the textfield could change, because this way I still have to position the 'button' text very precicely over the previous text

    if not possible I'm still thankfull for this, cheers =)
    Last edited by Hippyscum; 11-23-2007 at 03:29 PM.
    lalalalalalala

  6. #6
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    the only other method i can think of is to count the
    chars. in the textfield to apply a text format to -

    PHP Code:
    this.createTextField("mytext"103002001010);
    mytext.autoSize true;
    mytext.text "Hello Mum :)  Hello World";
    mytext.textColor 0xFF0000;

    btn.onRollOver = function(){
    blue = new TextFormat();
    blue.color 0x0000FF;
    mytext.setTextFormat(6,18,blue);
    }; 

  7. #7
    Great, Daddy-O! Hippyscum's Avatar
    Join Date
    Feb 2002
    Location
    Pays-Bas
    Posts
    382
    that'll be a bit too hard to work with, but I'll use your first suggestion, it will save me quite some button making time, thanks
    lalalalalalala

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