模糊標題的道歉。我想不出用更少的話來說出更好的方法。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。 –