--- In [email protected], "peuga" <[EMAIL PROTECTED]> wrote: > > 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> >
I think i found the answer... This code forms a component used in an accordion has as it child, there are two of these in the accordion. whats happening is when the accordion is created the child hidden gives me this error, while visible one works fine ... i think that until this second child is visible, the repeater (rep) never gets a valid instance and the 'arrivedDS' function can't do its thing. any ideia about how to solve this??? some help would be excellent thanks a lot cheers

