我正在尝试纯粹在动作脚本中编写项目渲染器(在 Flash Builder 4.6 中),因为与内置渲染器相比,动作脚本似乎提供了更快、更可定制的界面。(标签/图标等)。
我希望列表显示一个图像和两个文本字段。目前它将所有这些元素放在画布上,但是一旦我开始滚动(并且虚拟列表生效),我的旧元素就不会从舞台上删除。例如:滚动前 http://i.stack.imgur.com/Mk5HX.png 滚动后 http://i.stack.imgur.com/Qt7wZ.png
数据存储在名称、图像、公司和职务中。
关于这个问题的任何帮助,或者实际上是一种更好的方法来做我想做的事情,我们将不胜感激。
目前我有一堂课(我已经删除了导入等)
public class UILabel2 extends IconItemRenderer
{
public function UILabel2() {
super();
}
override public function set data(value:Object):void
{
super.data = value;
var DBname:String = data.name as String;
var DBimage:String = data.image as String;
var DBcompany:String = data.Company as String;
var DBtitle:String = data.Title as String;
//iconField = location;
trace(DBname);
label = DBname;
messageField = "Peanuts";
//iconWidth=64;
//iconHeight=64;
avatarHolder = new Graphic();
avatar = new BitmapImage();
iconField = DBimage;
avatar.fillMode = "clip";
avatar.source = DBimage;
avatarHolder.width = 64;
avatarHolder.height = 64;
avatarHolder.addElement( avatar );
addChild(avatarHolder);
text2 = new TextField();
text2.x = textMargin;
text2.y = 45;
text2.text = DBcompany;
addChild(text2);
var text3:TextField = new TextField();
text3.x = textMargin;
text3.y = 25;
text3.text = DBtitle;
addChild(text3);
//trace(listArrow1MED);
arrowHolder = new Graphic();
//arrowHolder.width = 20;
//arrowHolder.height = 20;
arrowHolder.x= Wsize-40;
//trace(Wsize);
arrow = new BitmapImage();
arrow.fillMode = "clip";
arrow.source = listArrow1LGE;
arrowHolder.addElement( arrow );
addChild(arrowHolder);
//iconField = avatar;
}