Skip to main content
Participant
August 24, 2016
Question

live update of UIComponent properties in inspector

  • August 24, 2016
  • 0 replies
  • 147 views

I would like to use Animate CC and UIComponents as UI editor. My problem is that some of properties are dependent on each other. When I change one of them then I would like to see live update of the second property in property inspector. Sample code:

public class Component extends UIComponent {

  protected var _componentScaleX:Number;

  protected var _componentWidth:Number;

  public function Component() {

     _componentScaleX = 1;

     _componentWidth = 100;

  }

  [Inspectable(defaultValue="1")]

  override public function get scaleX():Number {

       return _componentScaleX;

  }

  override public function set scaleX(value:Number):void {

       _componentScaleX = value;

  }

  [Inspectable(defaultValue="100")]

  override public function get width():Number {

       return _componentWidth * scaleX;

  }

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

       scaleX = value / _componentWidth;

  }

}

This topic has been closed for replies.