1 Reply Latest reply on Nov 16, 2007 11:15 AM by gvbrown49686

    Errors adding UIScrollBar

    gvbrown49686
      I'm using the following code to create a textfield, which should have a scrollbar, using the uiscrollbar:

      import xmlReader.*;
      import flash.display.*;
      import flash.events.MouseEvent;
      import flash.text.*;
      import fl.controls.*;
      (etc)

      aboutarea = new TextField();
      aboutarea.autoSize=TextFieldAutoSize.LEFT;
      aboutarea.htmlText = abouthtml;
      aboutarea.x=20;
      aboutarea.y=20;
      aboutarea.scrollRect;
      aboutarea.height=200;
      aboutarea.width=400;
      docRoot.addChild(aboutarea);

      var hScrollBar:UIScrollBar = new UIScrollBar();
      hScrollBar.direction = ScrollBarDirection.VERTICAL;
      hScrollBar.move(aboutarea.x, aboutarea.y + aboutarea.height);
      hScrollBar.width = aboutarea.width;
      hScrollBar.scrollTarget = aboutarea;
      docRoot.addChild(hScrollBar);

      (docRoot is a variable the references "root").

      This should work, according to all of the documentation I've read. However, I am getting a bunch of the following errors:

      at flash.display::DisplayObjectContainer/addChildAt()
      at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
      at fl.controls::BaseButton/fl.controls:BaseButton::draw()
      at fl.core::UIComponent/drawNow()
      at fl.controls::ScrollBar/fl.controls:ScrollBar::draw()
      at fl.controls::UIScrollBar/fl.controls:UIScrollBar::draw()
      at fl.core::UIComponent/::callLaterDispatcher()

      Any ideas