--- In flexcoders@yahoogroups.com, "criptopus" <sd_br...@...> wrote: > > I'm trying to get these X's to appear in a circle and not having much lock > with it. The array seems to work when I trace it but nothing appears on the > screen. I tried just defining an MXML ArrayCollection and it worked but I > want them Bindable so I can move them about. > > Code so far... > > <?xml version = "1.0"?> > <mx:Application xmlns:mx = "http://www.adobe.com/2006/mxml" > xmlns = "*" > layout = "absolute" > creationComplete = "makeChange();"> > <mx:Script> > <![CDATA[ > > [Bindable] > private var myLabels:Array = new Array(); > > private function makeChange():void { > var i:int, cx:int, cy:int; > for (i = 0; i < 36; i++) { > cx = 200 + 200 * Math.sin(i / 18 * Math.PI); > cy = 200 - 200 * Math.cos(i / 18 * Math.PI); > myLabels.push({ label: "X", x: cx, y: cy }); > } > } > ]]> > </mx:Script> > > <mx:ArrayCollection id = "myLabelsAC" source = "{myLabels}"/> > > <mx:Repeater id = "myLabelsRep" dataProvider = "{myLabelsAC}"> > <mx:Label id = "nameLabel" > x = "{myLabelsRep.currentItem.x}" > y = "{myLabelsRep.currentItem.y}" > text = "{myLabelsRep.currentItem.label}" > fontSize = "20"/> > </mx:Repeater> > > </mx:Application> > > Any help appreciated as I am just a learner. >
Arrays aren't bindable, so <mx:ArrayCollection id = "myLabelsAC" source = "{myLabels}"/> Doesn't update when you change the array. Manually set the source property on myLabelsAC at the end of your function. HTH; Amy