模糊标题的道歉。我想不出用更少的话来说出更好的方法。ItemRenderer对象更改属性
基本上,我正在创建一个自定义ItemRenderer(IR)。 IR的左侧有一个标签,右侧有一个图标。右侧的图标是动态的(可以是添加或删除图标,也可以是任何图标)。这工作很好,给我我需要的控制。
现在,问题是,当我在我的移动应用程序中滚动列表时,图标会改变。
应该怎么看:
如何它看起来通过拖动Test3的使用手指(或鼠标仿真器)滚动后:
正如你可以看到,图标改变,但标签不。我在我的Spark List组件上有dragEnabled
,dropEnabled
和dragMoveEnabled
都设置为false。图标选择运行的唯一时间是creationComplete
,所以在某个点上它没有办法选择不同的图标。我也可以验证数据本身是在发生这种变化后应该是什么。
下面是创建项目的MXML:用于选择
<s:HGroup width="100%" verticalAlign="middle" left="{this.sideSpacing}" right="{this.sideSpacing}" top="{this.sideSpacing}" bottom="{this.sideSpacing}">
<s:Label id="text" width="100%"/>
<s:Image id="actionIcon" buttonMode="true" click="actionIconClick(event);">
<s:filters>
<s:DropShadowFilter alpha=".45" angle="90" distance="3" blurX="3" blurY="3" quality="3"/>
</s:filters>
</s:Image>
</s:HGroup>
<s:Rect width="100%" height="1" bottom="0" alpha=".1">
<s:fill>
<s:SolidColor color="#000000"/>
</s:fill>
</s:Rect>
而且可能过于复杂的AS3应显示的图标:
private function creationComplete(e:Event):void {
if (this.data.actionIcon != null) {
this.actionIconType = this.data.actionIcon;
if (this.data.actionIcon == ACTION_ICON_ADD) {
this.actionIcon.source = this.addBitmapSource;
}
else if (this.data.actionIcon == ACTION_ICON_REMOVE) {
this.actionIcon.source = this.removeBitmapSource;
}
else {
this.actionIcon.source = null;
this.actionIcon.visible = false;
this.actionIcon.includeInLayout = false;
}
}
else {
this.actionIcon.source = null;
this.actionIcon.visible = false;
this.actionIcon.includeInLayout = false;
}
}
什么可能会造成这个问题?
呃......该死的。我搜索了一个本地组件来做到这一点,并空了。这只是数字。无论如何,我尝试了'dataChange'事件,并提出了同样的问题。我会坚持原生组件(我真的希望我现在已经找到了它)。谢谢你,Flextras。 –