R – Flex binding and AS3

apache-flexbindingdegrafa

I have a degrafa surface into a canvas container.
I want to link both width and height.
When i use binding like it works as expected:

// binding
   BindingUtils.bindProperty(rect,"height",this,"height"); 
   BindingUtils.bindProperty(rect,"width",this,"width"); 

Now, someone told me that i should do it on validateSize() or updateDisplayList(),
with my current knowledge of flex i dont realy know why but i tried the following

override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {

    trace(unscaledWidth, unscaledHeight);
    this.width = unscaledWidth;
    rect.width =unscaledWidth;
    this.height = unscaledHeight;
    rect.height = unscaledHeight;

}

The degrafa rectangle get resized well but not the 'this' canvas container.
They seem to be not binded, did i miss something ?

Also i would like to modify a little bit the relation in rect.width = this.width with some factor in it which i cant do using the bindproperty method.

Thanks a lot for any clue.

Best Answer

Somewhere in your updateDisplayList you should call:

super.updateDisplayList(unscaledWidth, unscaledHeight); 
Related Topic