1 Reply Latest reply on Jul 9, 2008 11:37 AM by Izzy1138

    BindingUtils.bindProperty on a formula?

    Solerous Level 1
      I have run into a quirk with binding in actionscript. If I use the following line:

      BindingUtils.bindProperty(myLegend, "width", myPanel, "width");

      A scrollbar appears (my legend layout is horizontal) on the bottom so that you can scroll. Presumably this is to accomodate the padding on the left and right of the chart. However I don't just want to get rid of the padding as this would look terrible. What I want is to somehow say:

      BindingUtils.bindProperty(myLegend, "width", myPanel, "width" -10 );

      In other words, not make a strict 1 to 1 correspondance, but have the myLegend width be slightly less than the myPanel width. I know this can be done in mxml, but how is it achieved in Actionscript?


        • 1. Re: BindingUtils.bindProperty on a formula?
          Izzy1138 Level 1
          Solerous,
          I would look at adding a setter with a name like widthAdjusted. This way you are calling the AS to do the work you want and not just 1 to 1.

          BindingUtils.bindProperty(myLegend, "widthAdjusted", myPanel, "width" -10 );

          class MyLegend {
          ...
          public function set widthAdjusted(standardWidth : int) : void {
          width = standardWidth - 10;
          }