Skip to main content
November 16, 2007
Question

Errors adding UIScrollBar

  • November 16, 2007
  • 1 reply
  • 142 views
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
This topic has been closed for replies.

1 reply

November 16, 2007
Well, after messing with this for a few hours, it appears that you can not add a scrollbar from a subclass?