PDA

View Full Version : [AS3] UIScrollBar not working remotely


patorikku
12-03-2011, 07:41 AM
Hey,

My UIScrollBar works with my text field when I preview my file locally.

But when I upload my website files to my server romotely. The scroll bar is there, but it does not have any arrows and is not scrollable.

This is my code. I have the correct import statements.

//UIScrollBar component code
var scrollBar:UIScrollBar = new UIScrollBar();
scrollBar.direction = "vertical";
scrollBar.x = 752;
scrollBar.y = 45;
scrollBar.setSize(myTextField.width, myTextField.height);
addChild(scrollBar);
scrollBar.scrollTarget = myTextField;

My textfield code is above this. I get no errors. It just does not work when I upload it.

Thanks in advance.

solisarg
12-03-2011, 12:45 PM
Are you loading dinamyc text to your textfield? If that the case, you need to set the target when text finish to load

Jorge

patorikku
12-03-2011, 01:37 PM
I think it is dynamic text. The text file is a notepad file being retrieved from another folder.

How would I go about doing what you said?

solisarg
12-03-2011, 01:41 PM
How are you loading the text?

Jorge

patorikku
12-03-2011, 01:55 PM
Using file paths and myReq

//declare path and file name to the text document
filePath = "pagetxt/homepageText.txt";
myReq = new URLRequest(filePath);
//create URLLoader to load the file
myLoader = new URLLoader();
myLoader.addEventListener(Event.COMPLETE, fileLoaded)
myLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);


Theres more code to this, but it functions perfectly.

solisarg
12-03-2011, 02:34 PM
So you need to set the UIScrollbar in the fileLoaded function, that's the callback when text finish to load

Jorge

patorikku
12-03-2011, 03:12 PM
So you need to set the UIScrollbar in the fileLoaded function, that's the callback when text finish to load

Jorge

I moved all the UIScrollBar code within the fileLoaded function and it seems to have done the trick. Thanks for the help.