You're creating a bindable Array that is full of non-bindable Objects.

Since your Array is bindable you would be able to bind to the Array itself,
and bindings would get fired when the Array changes (ir you do something
like objs = new Array()). But inside that Array are simple Objects that are
not bindable. So no bindings will ever fire when: a) objects are added and
removed from the array, if you wanted that you should use ArrayCollection
and getItemAt(), and b) no bindings fire when properties of those Objects
get updated.

So one way to change your example is to use a VO class to hold the data that
is in those objects, and make the entire class, or certain properties,
bindable. So if you had a VO class that had x, y, percent, and type
properties that were all bindable then your example would work. If you want
a quick but pretty dirty solution try just wrapping your objects in the
ObjectProxy class, so your Array creation line might look like this:

public var objs:Array = new Array(new ObjectProxy({x:30, y:22, percent:20,
type:"community"}) ... );

But it's worth having a proper undertanding of how binding really works, so
I'd advise against using ObjectProxy to force binding to work.

Doug

On Sun, Apr 20, 2008 at 7:18 PM, grimmwerks <[EMAIL PROTECTED]> wrote:

>   Could someone PLEASE point out what I'm doing wrong in the following? I
> want to bind a numeric stepper to a certain size and have it changed live;
> I'm trying to change the scale of these buttons to the numeric steppers;
> here's a test:
>
> -------
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";  width="100%"
> height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off"  >
>
> <mx:Repeater id="rep" dataProvider="{objs}">
> <mx:Button  x="{Number(rep.currentItem.x)}" y="{Number(rep.currentItem.y)}"
> width="{(Number(rep.currentItem.percent)*defaultSize)}"
>   height="{(Number(rep.currentItem.percent)*defaultSize)}" styleName="{
> String(rep.currentItem.type)}" label="{
> String(rep.currentItem.type).toUpperCase()}"
> toolTip="{'At the moment '+ String(rep.currentItem.type)+' is '
> +rep.currentItem.percent+'% of my life at the moment'}"  />
> </mx:Repeater >
>
> <mx:NumericStepper id="tmp" change="{objs.getItemAt(0).percent=tmp.value}"
> value="{objs[0].percent}" maximum="100" />
>
>
>
> <mx:Script>
> <![CDATA[
> import mx.controls.Button;
> import mx.core.BitmapAsset;
> import mx.managers.DragManager;
>         import mx.core.DragSource;
>          import mx.events.DragEvent;
>        import flash.events.MouseEvent;
>         import mx.effects.easing.*;
> import mx.binding.utils.BindingUtils;
> import mx.collections.ArrayCollection;
>
>
> import mx.controls.Alert;
> import mx.utils.ObjectUtil;
> import mx.core.Application;
>
>
> private var offX:Number;
> private var offY:Number;
>
>
> [Bindable]
> public var objs:Array = new Array({x:30, y:22, percent:20, type:
> "community"},{x:90, y:22, percent:25, type:"work"},{x:110, y:72,
> percent:45, type:"self"},{x:70, y:120, percent:15, type:"faily"});
>
>
> [Bindable]
> private var defaultSize:Number = new Number(6);
>
>
>
>
> ]]>
> </mx:Script>
>
>
>
>
> </mx:Application>
>
>  
>

Reply via email to