-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of rigidcode
Sent: Wednesday, April 26, 2006 8:39 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] How to programmatically make a custom
ListItemRender?
I'm trying to make a custom ListItemRenderer in Actionscript. I was
able to make it display the list correctly, but when I click on
anything in the list, I get this error:
TypeError: Error #1009: null has no properties.
at
mx.controls::List/drawItem()[C:\dev\beta2\sdk\frameworks\mx\controls\Lis
t.as:1416]
at
mx.controls.listClasses::ListBase/selectItem()[C:\dev\beta2\sdk\framewor
ks\mx\controls\listClasses\ListBase.as:2907]
at
mx.controls.listClasses::ListBase/mouseDownHandler()[C:\dev\beta2\sdk\fr
ameworks\mx\controls\listClasses\ListBase.as:4369]
at
mx.controls::List/mouseDownHandler()[C:\dev\beta2\sdk\frameworks\mx\cont
rols\List.as:1801]
Every function in that call stack is not in the documentation.
My hello worldish custom listitemrenderer so far is:
public class CustomItemRenderer extends HBox implements IFactory,
IListItemRenderer {
public var thelabel:Label;
public function CustomItemRenderer() {
super();
this.thelabel=new Label();
this.thelabel.percentWidth=100;
this.addChild(this.thelabel);
}
public function newInstance():* {
return new CustomItemRenderer();
}
public override function get data():Object {
return super.data;
}
public override function set data(value:Object):void {
this.thelabel.text=value['label'];
super.data=""> dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
}
}
I also tried with IDropInListItemRenderer, and I get the same error.
Here is my instantiation.
var mylist:List = new List();
mylist.dataProvider=this.myarraycollection;
mylist.itemRenderer=new CustomItemRenderer();
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
--
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
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.