[Flash CS3] AS 2: UIScrollBar

Hi there,
I have a problem with a ScrollBar.
I have created (creatEmptyMovieClip) on stage and populatedthem with two mc from the library.
One mc contains a textField with some text (loaded from en external file). The other mc contains the Title for the text. The Title is actually a button which will make the text either visible or invisible (alternatively) when clicked.
So far so good.

Next step was to allow the text to be repaced with a much longer one (loaded from an external source again) and resize the mc accordingly with the control “textFiels.autosize=true”.

Now i needed the mc with the text to adjust its size to the available vertical space in the page and assign a ScrollBar to the text field to be able to scroll the text that is not visible in the size reduced mc.
So far so good.

note: To allow the ScrollBar to resize itself to the text height i had to extend the duration of the textField and set the “text.autosize” to ‘false’ in the next frame before assign the ScrollBar to it. If i left the autosize to true the reading of the actual text vertical size wouldn’t be correct (for reason i dont understand).
So far so good.

But now a problem arises. As soon as the ScrollBar is on stage the Title button, as well as other buttons, don’t behave correctly any longer.
Before the scrollbar I used to be able to click repeatedly on the Title button and the text will appear and disappear no problem. Now the button stays on its ‘Up’ status once i clicked on it (rather then the ‘Over’ one, forcing me to move the mouse away (rollOut) before i can roll over it again to activate its ‘Over’ status and ready to be triggered.

In all the various try I did it’s quite clear the problem depends on the presence of the scrollbar, regardless of the Scrollbar and the mc that contains it being visible or not. I also tried to disable it (ScrollBar.enable=false) but the problem doesn’t go away.
Reading through the ScrollBar Class section in the Help I imagined that the conflict might arise from the fact that with a ScrollBar, “unlike most other components, events are broadcast when the mouse button is pressed and continue broadcasting until the button is released”.
I don’t know enough of AS to work out if this is the problem nor how to resolve it anyway.

Anyone with a suggestion on how to fix this? As it happen to anyone before?

Here are some excerpt of the code

// The Button title
_root.createEmptyMovieClip(“item0”,8);
_root.item0.attachMovie(“titleMain”, “content0”,8);

//The movie that contains the text
_root.createEmptyMovieClip(“item1”,7);
_root.item1.attachMovie(“Copy Intro”,“content1”,7);

//Frame 1 of the Copy Intro mc: loading text from ext file
var format = new TextField.StyleSheet();
var path = “flash.css”;
format.load(path);
format.onLoad = function(success) {
if (success) {
output.styleSheet = format;
myLoadVar = new LoadVars ();
myLoadVar.load(“Nyet.txt”)
myLoadVar.onLoad = function (success){
if (success == true) {
output.htmlText=myLoadVar.intro;
}
}
} else {
output.text = “Error loading CSS file!”;
}
output.autoSize=true;
};
stop();

// Frame 2 (-goTondPlay(2) is called from a third button on stage).
my_txt.htmlText=myLoadVar.NyetAll;
my_txt.autoSize=true;

availableHeight=_root.maximumText;
actualTextHeight=my_txt._height;

_root.optimalHeight= availableHeight <= actualTextHeight ? availableHeight : actualTextHeight;

//Frame 3
my_txt.autoSize=false;
my_txt._height= _root.optimalHeight;

this.createClassObject(mx.controls.UIScrollBar, “my_sb”, 20);

my_sb.setScrollTarget(my_txt);

my_sb.setSize(16, my_txt._height);

my_sb.move(my_txt._x + my_txt._width-16, my_txt._y);

_root.allinea();
stop();

If anyone can understand this he/she will be my saviour and hero,

Thanks for now
Daniele

I just found out that the scrollBar isn’t actually creating the conflict. i removed it altogether and the probelm is still there…

Thanks anyway
Daniele

For anyone who might incur in the same problem with the UIScrollBar.
I eventually find out that the problem had nithing to do with the code.
I was using FlashCS3 but I had my publishing setting set on Flash8. The mere presence in the library of the ScrollBar would conflict with my other buttons. That is without even load the scrollbar onstage!!! and all i had to do was to switch the settings to Flash9.

It might be very obvious to some but it really gave me a headache. Hopefully if someone has the same problem will read this before going mad

bye, daniele