2 Replies Latest reply on Sep 10, 2010 9:54 PM by scotchfasterr

    Custom component with a designable property


      This is a really basic question that has probably been answered a million times before, but it's stumping me.


      I've written a MXML component with a public property. I can add an instance of the component and set its property in the designer. However, my changes to the property are not reflected in the Design view - they only show at runtime. The consequence is that I'm really flying blind when it comes to designing my user interface.


      Is there something I'm missing, or is this is just a limitation of the Flex Designer?


      Here's my custom component, called "Planet.mxml". Note that the public property "planetColor" colors the contained image. Thanks in advance.



      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="300" height="300" initialize="initializeColorTransform()">
        private var _planetColor:uint = 0x7f7f7f;

        public function get planetColor(): uint
         return _planetColor;
        public function set planetColor(value: uint):void
         _planetColor = value;
        private function initializeColorTransform():void
         var r:Number = (_planetColor >> 16) & 255;
         var g:Number = (_planetColor >> 8) & 255;
         var b:Number = (_planetColor) & 255;                 
          if (planet != null)
          planet.transform.colorTransform = new ColorTransform(r/255, g/255, b/255);