0 Replies Latest reply on Apr 24, 2007 9:56 AM by dishmael

    TreeItemRenderer

    dishmael
      I've created a custom TreeItemRenderer in AS and everything seems to work fine; however I want to use a custom ToolTip based on a Panel. The title and text for the tooltip come from the custom TreeItemRenderer; however I can't figure out how to use a custom Panel for the tool tip in AS. Here's some of the code...

      TreeItem.as

      override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {

      super.updateDisplayList(unscaledWidth, unscaledHeight);

      if (super.data) {
      if (TreeListData(super.listData).hasChildren) {
      var tmp:XMLList = new XMLList(TreeListData(super.listData).item);
      var myStr:int = tmp[0].children().length();
      super.label.text = TreeListData(super.listData).label + " (" + myStr + ")";
      }

      super.toolTip = TreeListData(super.listData).item.@description;
      }
      }

      ToolTipPanel.as

      <mx:Panel xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300" title="Name:"
      implements="mx.core.IToolTip" alpha=".8" borderThickness="2" backgroundColor="0xCCCCCC"
      dropShadowEnabled="true" borderColor="black" borderStyle="solid">

      <mx:Script>
      <![CDATA[

      override public function set title(value:String):void {
      super.title = "Name: " + value;
      }

      public function get text():String {
      return null;
      }

      public function set text(value:String):void {

      }
      ]]>
      </mx:Script>

      <mx:Label x="10" y="10" text="Description:" fontWeight="bold"/>
      <mx:TextArea id="bodyText" left="10" top="36" right="10" bottom="10"/>

      </mx:Panel>



      I tried to use super.toolTipCreate on the TreeItem.as but that didn't work. Can someone point me in the right direction?