I'm trying to attach an instance of UIScrollbar component to a dynamic text field inside of an instance of a class that is being made after some XML is loaded. The scroll bar component is getting properly attached, as the size of the slider varies depending on the amount of content in the text field, however, it won't scroll.
Here's the code:
function xmlLoaded(evt:Event):void
{
//do some stuff
for(var i:int = 0; i < numProfiles; i++)
{
var thisProfile:profile = new profile();
thisProfile.alpha = 0;
thisProfile.x = 0;
thisProfile.y = 0;
thisProfile.name = "profile" + i;
profilecontainer.addChild(thisProfile);
thisProfile.profiletextholder.profilename.htmlText = profiles[i].attribute("name");
thisProfile.profiletextholder.profiletext.htmlText = profiles[i].profiletext;
//add scroll bar
var vScrollBar:UIScrollBar = new UIScrollBar();
vScrollBar.direction = ScrollBarDirection.VERTICAL;
vScrollBar.move(thisProfile.profiletextholder.profiletext.x + thisProfile.profiletextholder.profiletext.width, thisProfile.profiletextholder.profiletext.y);
vScrollBar.height = thisProfile.profiletextholder.profiletext.height;
vScrollBar.scrollTarget = thisProfile.profiletextholder.profiletext;
vScrollBar.name = "scrollbar";
vScrollBar.update();
vScrollBar.visible = (thisProfile.profiletextholder.profiletext.maxScrollV > 1);
thisProfile.profiletextholder.addChild(vScrollBar);
//do some more stuff
}
}
I've also tried it with a UIScrollBar component within the movieclip/class itself, and it still doesn't work. Any ideas?
Thanks in advance!