0 Replies Latest reply on Apr 30, 2007 8:45 AM by Ed_Syrett

    Custom control in Design View

      I've been using the Scheduling Framework from the Labs site and neither the schedule viewer or the timeline components are visible in design view. If you click in the right place then a sizing rectangle does appear, but thats no good if you have more than one custom component (you click on one and the previously selected one disappears.....:-)

      I wanted to find out whether there was something simple I could do to make these components visible at all in design view so I created a really simple custom component that just creates a label and positions it on itself. The custom component derives from ScrollControlBase just like ScheduleView and Timeline. Heres the code....

      package Components
      import mx.core.ScrollControlBase;
      import mx.controls.Label;

      public class CustomComponent extends ScrollControlBase
      private var _label:Label;
      private var _text:String;

      [Inspectable(category="General", defaultValue="")]
      public function get text():String
      return _text;

      public function set text(value:String):void
      _text = value ;


      override protected function commitProperties():void
      _label.text = _text ;

      override protected function createChildren():void

      _label = new Label;

      protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
      super.updateDisplayList(unscaledWidth, unscaledHeight);

      _label.x = 100;
      _label.y = 100;
      _label.width = 200;
      _label.height = 20;
      _label.visible = true ;

      ..and the calling application xml.....

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ns1="Components.*">
      <ns1:CustomComponent x="46" y="34" width="400" height="300" text="Set in CustomComponent:text"/>
      <mx:Label x="46" y="342" text="On The Application" width="120"/>

      In design view, the label with text "On the Application" shows up, but alas theres absolutely nothing in CustomComponent.

      What can I do to make this (and other) custom components appear in the design view?