I may not be understanding correctly, but if you re-assign the
Repeater.dataProvider, the repeater should re-execute.   You should not
have to do anything else.  

 

Are you re-assigning the dataProvider?  Or are you counting on the
binding updating the dataProvider?   If the second, verify that the
singleton binding is working correctly.  Maybe create a test
ChangeWatcher?  Binding can be hard to debug.

 

Tracy 

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of grimmwerks
Sent: Thursday, April 03, 2008 4:21 AM
To: [email protected]
Subject: [flexcoders] help with databinding -- repeater listening for
event?

 

I'm a bit frustrated here and hope someone can point out where I've gone
wrong.

 

I've got a repeater that is drawing out 4 circles and binding to a
Singleton class' variable via binding -- all this works well the first
time -- the Singleton class is loading in xml that holds the x/y and
size coords for these 4 circles.

 

I want to load in the next 4 circles xml and have the repeater redraw
these 4 circles - how best to do this? If I'm using a custom canvas to
draw these 4 circles; should the canvas itself redraw upon the
CircleData.getInstance().currentCircle change?!?

 

 

If it's not clear what I'm doing, here's some code.

 

main.mxml is drawing out a CircleLayout.mxml as a component (Canvas),
and inside there is:

 

         

        <mx:Repeater id="rep"
dataProvider="{CircleData.getInstance().currentCircle.circle}">

                    <mx:Button   x="{Number([EMAIL PROTECTED])}"
y="{Number([EMAIL PROTECTED])}"
width="{(Number([EMAIL PROTECTED])*defaultSize)}" 

        
height="{(Number([EMAIL PROTECTED])*defaultSize)}"
styleName="{String([EMAIL PROTECTED])}"
label="{String([EMAIL PROTECTED]).toUpperCase()}" 

        
useHandCursor="{CircleData.getInstance().isEdit}"
buttonMode="{CircleData.getInstance().isEdit}"/>

        </mx:Repeater >

               

               

 

And within the CircleData class:

 

        public function setCircleData(event:Event):void{

                    circlesList = new XML(xmlURLLoader.data);

                    pos = circlesList.item.length()-1;

                    var tmp:XMLList = [EMAIL PROTECTED];

                    // change this datelist constructor to have id# of
cirlce items

                    dateList = new ArrayCollection();

                    for(var i:uint=0; i<tmp.length(); i++){

                                dateList.addItem({label: tmp[i],
data:i});

                    }

                    loadCircles(pos);

        }

        public function loadCircles(newPos:Number):void{

                    currentCircle = circlesList.item[pos];

        }

 

And the combo box is really just doing
CircleData.getInstance().loadCircles(pos)

 

But the repeaters aren't firing off the redraw again?

 

 

 

 

Reply via email to