dcsimg
A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: change combobox text colour pls?

  1. #1
    Senior Member
    Join Date
    May 2004
    Posts
    187

    change combobox text colour pls?

    how do you change the text colour in the combobox component or indeed the background?
    thx

  2. #2
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  3. #3
    Junior Member scudsucker's Avatar
    Join Date
    Feb 2003
    Location
    Cape Town, RSA
    Posts
    1,509
    Combo boxes are very irritating.. but if you follow the instructions at livedocs ( link above ) you can do it.

    I can change everything except scrollbars... does anyone know how to change the color of the scrollbars?
    Hariyemadzisawira nhaka yedu! Down the SCUD and win!
    I'm too lazy to read Private Messages.

  4. #4
    Senior Member
    Join Date
    May 2004
    Posts
    187
    LOL.
    I will be sure to call back if i cant understand it. Which i dont think I can ...lol..

  5. #5
    Senior Member
    Join Date
    May 2004
    Posts
    187
    ... oh my lord.
    Was this components thing created to make life easier or harder?
    I think i have to look for a 'global component style'
    ... dear lord...

    Why couldnt they just have it up on the properties box?
    Or just have like:
    mycombobox.setstyle(red); or summat?

    sheesh!???

    I need a week here..

  6. #6
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    to change the color of the text in a combo box, here's the code.
    PHP Code:
    mycb.setStyle("color",0xFF0000
    This changes the color of the text combo box with the instance name - mycb
    to red. to change the background to say, black
    PHP Code:
    mycb.setStyle("backgroundColor",0x000000
    If you don't think you're going to like the answer, then don't ask the question.

  7. #7
    Senior Member
    Join Date
    May 2004
    Posts
    187
    ok, i have added that everywhere but it isn't doing anything.
    Where do I have to insert this?
    ??

  8. #8
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    what version of flash r u using? what is the instance name of your combo box? also do you want all the cells of the combobox to different colors?
    If you don't think you're going to like the answer, then don't ask the question.

  9. #9
    Senior Member
    Join Date
    May 2004
    Posts
    187
    ok, using mx 2004.
    the instance of the combobox is called 'selector' but I tried creating another in a totally new flash file and called it 'eee'. Couldnt be bothered to create a specific name.
    Still no go.

    No Dont need all the cells different colours, just set the whole lot to one colour. It's currently a dark red background (combo) on a black background (all) with darker red text.
    About 0.0002 font size.

    lol.

    I have inherited this flash file and it had the combo box already there. It has a whole load of componets and I think it has a global style setting not a single combobox one taht I can find, but I am new to the whole components drag and drop-reams-of-code thing.
    I have tried to use:
    on(load)
    {
    eee.setStyle("backgroundColor",0x000000);//change to selector. when in the other one
    eee.setStyle("color",0xFF0000);
    trace("load entered");
    }
    and I can see the trace but I cant see any difference to the combo box.
    The combo box sits inside a MC that has no instance name, but have tried the above code inside the actual combo box section (clicked the blue arrow on the properties box of the combobox and that should be the place to put it but nothing shows, bar the trace)
    Am wondering if I need to spend hours trying to locate the code in the component code that refers to styles of a 'global' nature or prehaps just call it a day and have a 'chocco-mocca-bokka-lockka' drink instead and buy each visitor a magnifying glass.....<sigh>

  10. #10
    Senior Member
    Join Date
    May 2004
    Posts
    187
    ...something else I have also noticed. In mx2004 the combo box i created to test the code doesnt have a 'change handler' option in the properties panel.
    I had to copy and past the other one inorder to get it.

    Is that because I havent got MX2004 pro?

    ??

  11. #11
    Senior Member
    Join Date
    May 2004
    Posts
    187
    ok this is what happened..
    On the combobox I made I got all these to work:

    _global.style.setStyle("textRollOverColor", 0x00ff00);
    _global.style.setStyle("rollOverColor", 0x0000ff);
    _global.style.setStyle("alternatingRowColors", [0xFFFFFF, 0xBFBFBF]);
    _global.style.setStyle("fontSize",15);
    _global.style.setStyle("fontFamily","_sans");
    _global.style.setStyle("fontWeight","bold");
    _global.style.setStyle("themeColor","haloOrange");

    even without the combobox instance being made, and this was put into a new Layer on top the combobox itself...

    But it didint work on the one that I 'inherited', So then i delved into the Movie explore using '_global.' and found these...

    FLabelClass.prototype.setColor = function(col)
    {
    //this.labelField.textColor = 0xB65422;//original yukky colour
    this.labelField.textColor =0xE18D60//MY new brighter text colour in combo box.
    }

    FLabelClass.prototype.setLabel = function(label)
    {

    var val = this.hostComponent.styleTable.embedFonts.value;
    if (val!=undefined) {
    this.labelField.embedFonts = val;
    }
    this.labelField.setNewTextFormat(this.textStyle);
    this.labelField.text = label;
    this.labelField._height = this.labelField.textHeight + 5; // 2;//My new vertical space per cell!!!
    }

    ......Nope no idea why there is so much code there, but... I played about with them.....and what do you know -it worked!

    alright!

    Ok, I havent found the 'backgrounds' yet on the inherited one but that's ok..

    If anyone else is having this issue there it is folks!

    ENJOY!

    Shaf

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