dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [RESOLVED] set style for disabled check boxes

  1. #1
    Member
    Join Date
    Apr 2008
    Posts
    97

    resolved [RESOLVED] set style for disabled check boxes

    I'm trying to set the style for a check box, works fine when the check box is enabled, but once disabled the check box reverts back to its default disabled style.

    How do I change the style for disabled check boxes?

    Here is the code I used for defining the style and setting it to the checkbox:
    Code:
    var msg_frmt:TextFormat = new TextFormat("Verdana",10,0xFFFFFF,null,null,null,null,null,"left",null,null,null,null);
    
    var chkbox:CheckBox = new CheckBox();
    chkbox.setStyle("textFormat",msg_frmt);

  2. #2
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Why not just change the skin for the disabled box?

  3. #3
    Member
    Join Date
    Apr 2008
    Posts
    97
    I'm not sure what you mean, when I edit the symbol from the library there is no section to modify the text, but you can edit everything else :-\

  4. #4
    Señor Member Mavrisa's Avatar
    Join Date
    Oct 2005
    Location
    Canada
    Posts
    506
    I was also wondering how to do this... have you tried setting the textformat after disabling the box? Let me know when you figure it out.
    Haikus are easy
    But sometimes they don't make sense
    Refrigerator

  5. #5
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Okay, sorry for taking so long to get back to you. Been a busy weekend moving and all, LOL.

    Anyway, to set the disabled text format you'll want to do something like this:

    Code:
    import fl.controls.*;
    
    var c1:CheckBox = new CheckBox();
    var txt1:TextFormat = new TextFormat();
    txt1.color = 0x006600;
    
    addChild(c1);
    c1.enabled = false;
    c1.setStyle("disabledTextFormat", txt1);
    Also, you could just set the label to nothing and draw your own textfield and position it and set it's styles as well.

    Also, a tip if you'd like. If you go into your program files to the adobe folder and look at the components source code, you can find the specific names of all the classes involved.

    Hope this helps. Let me know.

  6. #6
    Member
    Join Date
    Apr 2008
    Posts
    97
    hey jweeks, thanks for getting back to me hope the move went well.

    My checkboxes are generated dynamically so it would be a hassle, but the disabledTextFormat workeded!

  7. #7
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Cool, glad to help, and yep, aside from a sore back, went well, LOL. Thanks.

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