Hi people... im new in the flex world. im trying to create some components (images) that get their data from two sources, httpservice (xml file) and dataservice (spring bean). when the results from the dataservice arrive i want to provide the repeater with the data from the xml so when it is creating the images it can get the additional info from the data service needed by the "giveColor" function. The only problem is, when the results from the dataservice arrive i can't set the dataprovider for the repeater, i get a null reference! why is that???
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()" > <mx:Script> <![CDATA[ [Bindable] public var filename:Object; private var xmlpmrs:ArrayCollection; private var dspmrs:ArrayCollection; private function init():void { dspmrs = new ArrayCollection(); xmldata.send(); ds.fill(dspmrs); } private function arrivedDs(evt:Event):void { // rep is NULL rep.dataProvider = xmlpmrs; } ... giveColor function that uses "dspmrs" ... ]]> </mx:Script> <mx:HTTPService id="xmldata" url="assets/{filename}" fault="faultHandler(event)" result="xmlpmrs = xmldata.lastResult.linhas.linha as ArrayCollection"/> <mx:DataService id="ds" destination="pmrecord" fault="faultHandler(event)" result="arrivedDs(event)"/> <mx:Repeater id="rep" > <mx:Image source="assets/{rep.currentItem.imgfile}" toolTip="Linha: {rep.currentItem.id}" x="{rep.currentItem.x}" y="{rep.currentItem.y}" creationCompleteEffect="{giveColor(rep.currentItem.id)}"/> </mx:Repeater> </mx:Canvas>