If you need to pass in some values to an item renderer, you can use the following util.
package utils {
import mx.core.ClassFactory;
import mx.core.IFactory;
public class ItemRendererUtil {
public static function createWithProperties(renderer:Class, properties:Object):IFactory {
var factory:ClassFactory = new ClassFactory(renderer);
factory.properties = properties;
return factory;
}
}
}
And how to use on your datagroup / list…
<s:DataGroup dataProvider=“{new ArrayCollection(data as Array)}” itemRenderer=“{ItemRendererUtil.createWithProperties(renderers.ShuttleBoxRenderer, {stageLevel: stageLevel})}”>
<s:layout>
<s:HorizontalLayout/>
</s:layout>
</s:DataGroup>
And how to handle incoming value in your ItemRenderer…
<fx:Declarations>
<fx:Number id=“stageLevel”/>
</fx:Declarations>
Can someone share this with the prosigner, so he stops swearing?