Flex - 如何在ItemRenderer中更改文本字段的样式

时间:2012-06-20 13:02:54

标签: flex list itemrenderer

我可以使用MouseEvent和GetChildAt方法更改当前所选元素的样式。我需要有可能在不使用Mouse Evets的情况下从actionscript更改mx:text Control的颜色,例如列表中的第二个项目会改变颜色。

我该怎么做?

感谢您的帮助

            <mx:List id="carTypesList" name="carTypesList" dataProvider="{carTypesResult}"
            height="93%" width="470"
            change="{this.parentApplication.setSelectedTextStyleSelected(event)}"
            >
            <mx:itemRenderer >
                <mx:Component>
                    <mx:HBox horizontalGap="0" width="470" verticalScrollPolicy="off" horizontalScrollPolicy="off"
                             mouseOver="{this.parentApplication.setSelectedTextStyleOver(event)}"
                             mouseOut="{this.parentApplication.setSelectedTextStyleOut(event)}">
                        <mx:Image id="modelDisabled" name="{data.@id}"
                                  width="12" height="12"
                                  visible="{data.@disabled == 'X'?true:false}"
                                  includeInLayout="{data.@disabled == 'X'?true:false}"
                                  source="img/resfleet/blocked_ico.png" />
                        <mx:Text text="{data}"
                                 click="{this.parentApplication.setSelectedTextStyleSelected(event); this.parentApplication.isReadOnly('ZNM00030') == false?this.parentApplication.modelSelector.setTypeExt():''}"
                            width="{data.@disabled == 'X'?418:430}"
                            maxHeight="100" />
                        <mx:Image id="modelInfoIconWhite" name="{data.@id}" source="img/resfleet/info_ico_sq_wh.png"
                                  width="12" height="12"
                                  buttonMode="true"
                                  useHandCursor="true"
                                  click="{this.parentApplication.isReadOnly('ZNM00030') == false?this.parentApplication.modelSelector.showModelInfo(event):''}"/>
                        <mx:Image id="modelInfoIconBlue" name="{data.@modnm}" source="img/resfleet/info_ico_sq_bl.png"
                                  width="12" height="12"
                                  buttonMode="true"
                                  useHandCursor="true"
                                  visible="{data.@action == 'X'?true:false}"
                                  includeInLayout="{data.@action == 'X'?true:false}"
                                  click="{this.parentApplication.readOnlyMode == false?this.parentApplication.modelSelector.showActionInfo(event):''}"/>
                    </mx:HBox>
                </mx:Component>
            </mx:itemRenderer>
        </mx:List>

0 个答案:

没有答案