# Scroll Bar

**URL:** <https://forum.kirupa.com/t/scroll-bar/298455>\
**Category:** Uncategorized\
**Created:** [October 19, 2009, 2:21pm UTC](https://forum.kirupa.com/t/scroll-bar/298455 "2009-10-19T14:21:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wentworth](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/wentworth/32/3451_2.png) [@wentworth](https://forum.kirupa.com/u/wentworth)\
**Post date:** [October 19, 2009, 2:21pm UTC](https://forum.kirupa.com/t/scroll-bar/298455/1 "2009-10-19T14:21:35Z")

</div>

Here is some code that I need help with a Text field formatted with css and a UIScrollBar thrown in. The scroll bar sort of appears but does not function, the grey line appears but the slider itself doesn’t . The texts loads and I can scroll it with the mouse wheel. Any help much appreciated. I’m sure it’s a simple problem but I just can’t see it. Well here it is:-

import fl.controls.UIScrollBar;

var txt:TextField = new TextField();  
txt.x = 18;  
txt.y = 10;  
txt.wordWrap = true;  
txt.multiline = true;  
txt.width = 670;  
txt.height = 635;  
txt.background = true;  
txt.backgroundColor = 0xFFFFFF;  
addChild(txt);

var sb:UIScrollBar = new UIScrollBar();  
sb.x = txt.x + txt.width;  
sb.y = txt.y;  
sb.height = txt.height;  
sb.scrollTarget = txt;  
addChild(sb);

function loadMyText():void {  
var url:String = “texts/textActivPilot.txt”;

```
var loadIt:URLLoader = new URLLoader();
loadIt.addEventListener(Event.COMPLETE, textCompleteHandler);
loadIt.load(new URLRequest(url));

```

}

function textCompleteHandler(event:Event):void {  
var urlV:URLVariables = new URLVariables(event.currentTarget.data);  
txt.condenseWhite = false;  
txt.htmlText = urlV.content as String;  
txt.styleSheet = myStyleSheet;  
}

var flash\_css:URLLoader = new URLLoader();  
flash\_css.addEventListener(Event.COMPLETE, cssCompleteHandler);  
flash\_css.load(new URLRequest(“texts/css.css”));

var myStyleSheet:StyleSheet;

function cssCompleteHandler(event:Event):void {  
myStyleSheet = new StyleSheet();  
myStyleSheet.parseCSS(event.currentTarget.data);  
txt.styleSheet = myStyleSheet;  
loadMyText();  
}
