Well i figured it out ;)
 
What you want is a custom item renderer.
You must implement "IDropInListItemRenderer " and use a HBox component for example.
Look the "IDropInListItemRenderer " up in the help and you will see how to "implement" it.
 
For example i use a "container" and my code looks like this:
 
public class CellItem extends Container implements IDropInListItemRenderer {
    // Internal variable for the property value.
    private var __listData:BaseListData;
    // Make the listData property bindable.
    [Bindable("dataChange")]
 
     public function get listData():BaseListData
     {
       return __listData;
     }
 
     public function set listData(value:BaseListData):void
     {
       __listData = value;
 
       dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
     }
 
}
 
 
With this class you can add components as you like ;)
 
 
 
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]On Behalf Of Webdevotion
Sent: vrijdag 21 april 2006 12:40
To: [email protected]
Subject: [flexcoders] Re: DataGridItemRenderer with AS3

Isn't there anyone with some tips on this topic ?



 
On 4/20/06, Webdevotion <[EMAIL PROTECTED]> wrote:
Hello,

I'm trying to create a datagriditemrenderer using Actionscript.
I know I'm importing to much right now, it's for testing purposes ; )
Does anyone have some insight into this techniques ?

All I am seeing now is false in the cells of my datagrid.

Another question: I can't use addChildAt, but I want to
place some png files into the renderer.  How do I do this ?

Thanks!





My code:

package{
 import flash.display.*;
 import flash.events.*;
 import flash.util.*;
 import mx.core.*;
 import mx.controls.dataGridClasses.DataGridItemRenderer;
 import mx.controls.dataGridClasses.DataGridListData;
 import mx.controls.Label;
 
      
    public class Rating extends DataGridItemRenderer{
         // embed the solid start
      [Embed (source='assets/star.png')]
   private var Star:Class;

      // embed the solid start
      [Embed (source='assets/star_empty.png')]
   private var StarEmpty:Class;
      
      private var myListData:DataGridListData;
      private var ratingLabel:Label;
      
      public function Rating()
      {  
       super();
       var pic:Bitmap;
       var i:int;
       myListData = DataGridListData(listData);
       
       for(i=0;i<data;i++)
       {
        if((i+1)<=data)
        {
         pic = new Star();
        }else{
         pic = new StarEmpty();
        }
        pic.x = i*25;
        //this.addChildAt( pic,i );
       }
        ratingLabel = new Label();
        ratingLabel.text = "data.rating";
      }
 }
}




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to