A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Changing the color the cells of The data grid

  1. #1
    Member
    Join Date
    Apr 2004
    Posts
    85

    Changing the color the cells of The data grid

    Hello there,
    Is it possible to guide me for making a reference to Items in the data grid in order to change its properties when they wanna add to stage ?
    Thank you

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Here is a script I made for a component, which has a datagrid:
    PHP Code:
    package biz.Flashscript.helper
    {
        
    import fl.controls.listClasses.CellRenderer;
        
    import flash.text.TextFormat;
        public class 
    MyCellRenderer_0 extends CellRenderer
        
    {
            public var 
    customProperty:String "foo";
            public function 
    MyCellRenderer_0 ()
            {
                var 
    mydisTextFormat:TextFormat = new TextFormat ();
                
    mydisTextFormat.align "left";
                
    mydisTextFormat.font "Arial";
                
    mydisTextFormat.size 12;
                
    mydisTextFormat.color 0x000000;
                
                var 
    myTextFormat:TextFormat = new TextFormat ();
                
    myTextFormat.align "left";
                
    myTextFormat.font "Arial";
                
    myTextFormat.size 12;
                
    myTextFormat.color 0x000000;
                
                var 
    originalStyles:Object CellRenderer.getStyleDefinition();
                
    setStyle ("disabledSkin",BlueBackground);
                
    setStyle ("upSkin",BlueBackground);
                
    setStyle ("downSkin",GreenBackground);
                
    setStyle ("overSkin",OrangeBackground);
                
    setStyle ("selectedUpSkin",originalStyles.selectedUpSkin);
                
    setStyle ("selectedDownSkin",originalStyles.selectedDownSkin);
                
    setStyle ("selectedOverSkin",originalStyles.selectedOverSkin);
                
    setStyle ("disabledTextFormat",mydisTextFormat);
                
    setStyle ("textFormat",myTextFormat);
                
    setStyle ("textPadding",10);
            }
        }

    In the fla file add this:
    myDG.setStyle ("cellRenderer", MyCellRenderer_0);

    Then create a folder "Cellrenderer" and Movieclips with the name:
    BlueBackground, GreenBackground, OrangeBackground
    and make little squares with the colors you want.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Member
    Join Date
    Nov 2007
    Posts
    67
    nice one cancerinform, thanx for sharing

  4. #4
    Member
    Join Date
    Apr 2004
    Posts
    85
    thank you so much

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