3 Replies Latest reply on Jun 24, 2009 4:50 AM by ks_flex_user

    Overriding UIComponent's height, width setters..


      I'm writing a custom UIComponent, and would like to perform some custom actions when the height/width are set in mxml.


      e.g. the mxml will have something like


      <custom:MyComp id="mcid" width="30" height="40".......></custom:MyComp>


      and I'd like to write something such as this in  MyComp.as


      public override function set width (x:Number):void {

             super.width = x;

             // ... followed by my custom actions



      This is probably not the correct direction. The code written in this way results in a problem whereby the setter get called twice (the second time, it is called automatically via the property watcher as well --- with values that are not right). What's the correct way of implementing this? Thanks in advance.