Je tente d'attacher une instance de composant UIScrollbar à un champ de texte dynamique à l'intérieur d'une instance d'une classe en cours de chargement après le chargement d'un fichier XML. Le composant de barre de défilement est correctement attaché, car la taille du curseur varie en fonction de la quantité de contenu dans le champ de texte, cependant, il ne défilera pas.Problème lors du défilement d'un composant UIScrollBar dans une classe
Voici le 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
}
}
J'ai aussi essayé avec un composant UIScrollBar dans le MovieClip/classe elle-même, et il ne fonctionne toujours pas. Des idées?