PDA

View Full Version : trying to understand how scroll bars work



JohnN
October 28th, 2009, 07:28 PM
I am very new to flash/Actionscript and am trying to understand how things work before I start any projects.

I was playing with the scroll bar today, and do not understand it's behavior. I created a
dynamic text box called my_text and used the following code



for (var i=0;i<50;i++){
my_text.text += "this is a test" + i + "\n";
}

Encouraged that it worked as expected, I tried it a little differently. I added an input text box called called in_text, and tried the following code.



in_text.addEventListener(KeyboardEvent.KEY_UP, onInputLineKey);
function onInputLineKey(e:KeyboardEvent):void {
if (e.keyCode == 13) { // ENTER was pressed
for (var i=0;i<50;i++){
my_text.text += in_text.text + i + "\n";
}
}
}


This is what I do not understand. my_text was populated with the proper data, but my scroll bar was disabled. I could scroll through the list by highlighting the text, but that was it. What did i do wrong

thank you for your help

youremin
October 29th, 2009, 06:06 AM
but scrollBar component?
Or a custom scrollBar done by you?
In my case i prefer to do my own scrollbars, just a little of math :D

JohnN
October 29th, 2009, 03:08 PM
This was using the UIScrollBar component. I am able to scroll it making my own slider, but I just do not understand why the component can't handle this. I would think that for a basic slider the component would be the most efficient

youremin
October 29th, 2009, 04:33 PM
oh... well... i don't use components... i use my own... so ... i cant help you sorry

AHernandez
October 29th, 2009, 05:44 PM
The default scrollbar component basically sucks and fails miserably any time you want to do anything more than a simple test. You are better off creating your own custom scrolling functionality just using AS3.

JohnN
October 29th, 2009, 06:56 PM
Thank you for your help, you have at least confirmed my fears. I guess with the money they charge for this applicationn I had my expectations set way to high.

youremin
October 30th, 2009, 05:59 AM
It isn't that hard to code your own... i'm even making my own class to use on different projects the same scrollbar code with some tweens and such. It isn't really that hard...