A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] Set Text Format on a button

  1. #1
    Ctrl Z Ctrl Z F1 Ctrl Z Ctrl Z PONYACK's Avatar
    Join Date
    Nov 2005
    Location
    North Carolina
    Posts
    202

    [F8] Set Text Format on a button

    Hi

    here is the code that I am using on my button. It works fine but what I would like to happen is when you click the button the text stays highlighted

    Code:
    // text formatting
    
    // default text style
    textStyle = new TextFormat();
    textStyle.color = 0x000000;
    
    // rollover style
    rolloverStyle = new TextFormat();
    rolloverStyle.color = 0xFF0000;
    
    btn.onRollOver = function(){
    	// change Services text color to red
    	btnLabel.setTextFormat(rolloverStyle);
    }
    btn.onRollOut = function(){
    	// change Services text back to black
    	btnLabel.setTextFormat(textStyle);
    }

  2. #2
    Senior Member
    Join Date
    Jun 2001
    Location
    Sydney
    Posts
    124
    use btn.onPress and insert your styling options within that,
    eg.
    code:
    btn.onPress = function() {
    // change Services text color to red
    btnLabel.setTextFormat(rolloverStyle);
    }


  3. #3
    Ctrl Z Ctrl Z F1 Ctrl Z Ctrl Z PONYACK's Avatar
    Join Date
    Nov 2005
    Location
    North Carolina
    Posts
    202

    Hello

    Hey,

    thanks for the reply. The onPress does work but what I am trying to do is have the selected button remain highlighted or another color.

    I hope I am asking this qurestion right. In trying to search out an answer I have had some trouble composing the right question.

    In any case if you have some other ideas or thoughts on how to get this done I am open for suggestions

    thnaks again

    Ponyack

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