A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Adding icon to datagrid cell

  1. #1
    Senior Member
    Join Date
    Apr 2003
    Location
    MA
    Posts
    273

    Adding icon to datagrid cell

    I'm trying to add an icon (movieclip) to my DataGrid. I can get the icon to show up, but when I scroll the datagrid up and down the wrong cells get icons. It happens when one of the rows goes off the screen, since it recycles them it's moved to the bottom.

    Each row has {Name:"something", Type:"blah"} on it. I check for that blah when making the image. Here's the drawBackground method in my

    Code:
    CellRenderer for the DataGrid:
    
    override protected function drawBackground():void {
    	if(_listData.label == "blah" &&
    		this.getChildByName("blah") == null) {
    		var blah:icon_blah = new icon_blah();
    		blah.name = "blah";
    		this.addChild(blah);
    	}
    
    	super.drawBackground();
    }
    It checks if the cell it's on has the blah in the label. This works for the initial instantiation the gird. All the right rows get blah and it ignores the rest. However, when it scrolls up and down, the icons move to the wrong rows. I can't figure out why.

    Also, it seems like with the movieclip I'm using for the icon, I can't do any animation or add more than one symbol to it. If I try to draw a blue background in the icon with a box, or add a component like a checkbox inside it, they don't show up on the grid. What gives?

  2. #2
    Senior Member
    Join Date
    Apr 2003
    Location
    MA
    Posts
    273
    bump a doop

  3. #3
    Junior Member
    Join Date
    Mar 2007
    Posts
    9
    Yes please!

  4. #4
    Junior Member
    Join Date
    Dec 2008
    Posts
    1
    Hi,

    I have the exactly same problem.
    I think the problem is, the movieclip is added right, but there's no removing.
    Does anybody have an idea?

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