Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8555939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:14:22+00:00 2026-06-11T15:14:22+00:00

I have found several tutorials regarding CellRenderer that will change an entire list or

  • 0

I have found several tutorials regarding CellRenderer that will change an entire list or selected item, but Im not all that good with AS3 yet and need some help. I am loading a userlist from an xml file. Everything loads fine and well, but what Im looking to do is actually colorize it by the group.

Again, it loads to the list just fine, what I am looking to do is in the loop that adds them from the xml file, if its admin make it red font, green font for mod, black for member.

Any help please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:14:24+00:00Added an answer on June 11, 2026 at 3:14 pm

    There are couple of caveats to be aware of:

    1. If you’re planning to use a font format, also need to set the renderer style embedFonts to true
    2. Since you want to set styles for individual cells, first you need to wait for the list to be populate (finish it’s internal data setup part of the component’s lifecycle). This can be forced by calling drawNow() or invalidate()
    3. Finally, in the render handler access individual cell renderers via the itemToCellRender() method to set the styles.

    Here’s a basic example(and imagine a,b,c as admin,mod,member):

    //in a setup function
    {
    //some dummy data
                var data:XML = <users>
                                <user name="user 1" group="a" />
                                <user name="user 2" group="a" />
                                <user name="user 3" group="a" />
                                <user name="user 4" group="b" />
                                <user name="user 5" group="b" />
                                <user name="user 6" group="b" />
                                <user name="user 7" group="c" />
                                <user name="user 8" group="c" />
                                <user name="user 9" group="c" />
                               </users>
                //create a list
                var list:List = addChild(new List()) as List;
                list.setSize(600,400);
                list.move(0,400);
                //setup a font AND set embefFonts to true
                list.setRendererStyle("textFormat",new TextFormat("Siemens Sans SC Black",11,0xFF9900));
                list.setRendererStyle("embedFonts",true);
                //populate list
                for(var i:int = 0 ; i < data.user.length(); i++) list.addItem({label:String(data.user[i].@name),group:String(data.user[i].@group)});
                list.invalidate();//tell list to refresh itself
                list.addEventListener(Event.RENDER,listUpdated);//listen for the refresh
    }
            //after the list refreshed
            private function listUpdated(event:Event):void{
                //setup text formats
                var formats:Dictionary = new Dictionary();
                formats["a"] = new TextFormat("Siemens Sans SC Black",11,0x990000); 
                formats["b"] = new TextFormat("Siemens Sans SC Black",11,0x009900); 
                formats["c"] = new TextFormat("Siemens Sans SC Black",11,0x000099);
    
                var list:List = List(event.currentTarget);
                for(var i:int = 0 ; i < list.dataProvider.length; i++) {
                    var item:Object = list.getItemAt(i);
                    var cr:CellRenderer = CellRenderer(list.itemToCellRenderer(item));//get the individual cell renderers
                    cr.setStyle("textFormat",formats[item.group]); //set styles per cell
                }
                list.removeEventListener(Event.RENDER,listUpdated);//clear listener
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've investigated several C# DLL's and have not found any that work especially well.
I've looked through several posts but I haven't quite found any answers that have
I have found several tutorials for older versions of Maya, but, since I am
I have read several tutorials but I still do not have any clue :-)
I've found several tutorials on how to do this, but it doesn't work. Here's
I have read several tutorials, but I just can't this to work. My apache
I would like to use FastCGI with shell scripts. I have found several tutorials
There are several tutorials on how to implement custom AsyncTaskLoaders but none I found
I have found several tutorials describing the possibility to add an NSImageView with Interface
I have found several other questions here on S.O. (and the web in general)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.