# Visible/Hidden scrollbar for dynamix textfield populated from external XML file

**URL:** https://forum.kirupa.com/t/visible-hidden-scrollbar-for-dynamix-textfield-populated-from-external-xml-file/313035
**Category:** flash
**Created:** [August 18, 2010, 1:46pm UTC](https://forum.kirupa.com/t/visible-hidden-scrollbar-for-dynamix-textfield-populated-from-external-xml-file/313035 "2010-08-18T13:46:34Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bilalc](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@bilalc](https://forum.kirupa.com/u/bilalc)
#### Post date: [August 18, 2010, 1:46pm UTC](https://forum.kirupa.com/t/visible-hidden-scrollbar-for-dynamix-textfield-populated-from-external-xml-file/313035/1 "2010-08-18T13:46:34Z")

</div>

Hi everyone!

I am currently creating an online portfolio using Slideshowpro ([www.slideshowpro.net](http://www.slideshowpro.net)).

For some of my pictures I am using (external) captions from a XML file, inserted into a dynamic textfield. As some of the captions contain a lot of text I decided to add a UIScrollBar. However, when there is no text (no caption) available, I want the scrollbar to be hidden. Also if there is not enough text to warrant a scrollbar it would be great if it could be hidden!

Please if you feel you can help, take a look at my current code below. If you have any pointers as to how I can accomplish this then please let me know! All help is much appreciated 🙂

Code below, note that “t\_txt” is the instance name of my dynamic textfield:

import flash.text.TextField;  
import net.slideshowpro.slideshowpro.\*;  
import fl.controls.UIScrollBar;

XML.ignoreWhitespace = true;  
//remove scrollbar from stage, scrollbar component must be in library  
var sbContent:UIScrollBar = new UIScrollBar();  
sbContent.move(t\_txt.x+t\_txt.width,t\_txt.y);  
sbContent.setSize(t\_txt.width, t\_txt.height);  
sbContent.scrollTarget = t\_txt;  
addChild(sbContent);

function onImageData(event:SSPDataEvent) {  
if (event.type==“imageData”) {  
t\_txt.htmlText=event.data.caption;  
sbContent.update();  
}  
}

slide.addEventListener(SSPDataEvent.IMAGE\_DATA, onImageData);
