If the types are dynamic, I'd probably load the options into a hash map that
lives in your applications model - it would get updated say on application
load with the correct path values.
Then inside your item renderer, you would key into the hash object based on
the items appropriate value to return the icon Class for the appropriate
type, which you would then assign to the Image that will render the icon.
this could be easily applied in a dataChange event handler (depends on if
you are doing this inline or in an external item renderer/editor class.
model iconHash: {key1:"imagePath1",key2:"imagePath2",...} ; //created
dynamically at run time
Inline example:
<mx:ComboBox ..... dataChange="swapIcon()">
<component>
<mx:HBox>
<mx:Script>
<![CDATA[
private function swapIcon():void
{
if(data != null && data.keyField != null ){
var icnPath:String =
ModelLocator.getInstance).iconHash[data.keyField];
listIcon.source = icnPath;
this.invalidateDisplayList();
}
}
]]>
<mx:Script>
<mx:Image id="listIcon" />
<mx:Label text={data.labelField} />
.
.
.
On Mon, Mar 16, 2009 at 4:33 PM, Lucas Golden <[email protected]> wrote:
> I'm tying to make a Combo Box that will load Icons for the choices
> dynamically at run time using a image path from a data source.
>
> The closest I can find is a version in 2.01 done statically here:
>
> http://flexibleexperiments.wordpress.com/2007/04/28/flex-201-combobox-with-icon-support/.
> The finish product on that page is just about what I want.
>
> Any suggestions?
>
> Thanks,
> Luke
>
--
Darin Kohles
RIA Developer