How can I user getRepeaterItem to set the progress of a progress bar?
I have a progress bar inside a repeater and therefore I will need to use getRepeaterItem to set it's progress as suggested in this question.
How can I do that such that the value of progress may be taken from repMonitor.currentItem.threatLevel?
<mx:Accordion id="monAccordian" includeIn="Monitoring" x="10" y="10" width="554" height="242" change="monAccordianChange()" >
<mx:Repeater id="repMonitor" dataProvider="{monitoringArray}">
<mx:Canvas width="100%" height="100%" label="{repMonitor.currentItem.firstName+' '+ repMonitor.currentItem.lastName}" >
<mx:Image x="10" y="10" source="{repMonitor.currentItem.imageName}" width="175" height="118"/>
<s:Label x="200" y="14" text="Threat L开发者_C百科evel:"/>
<mx:ProgressBar x="200" y="30" mode="manual" label="" id="bar" width="200" />
</mx:Canvas>
</mx:Repeater>
</mx:Accordion>
This function needs to be called every time threatLevel changes in order to update Repeater items:
private function updateProgresses() : void
{
if (!bar) return;
for (var i : int = 0; i < bar.length; i++)
{
var p : ProgressBar = bar[i] as ProgressBar;
if (p)
{
p.setProgress(monitoringArray[i].threatLevel, 100);
}
}
}
精彩评论