Link to home
Start Free TrialLog in
Avatar of hauto
hauto

asked on

Scrollbar problem

Hi all,
I have used a scrollbar from the FUI Components connecting to a dynamic textfield.

Everytime when the flash loads the text file and I find the scrollbar always locate at the top, how to make it scroll to the end of the text?

Many thanks,
Hugo
Avatar of olcorado
olcorado

You can do one thing.When Flash loads the data.Make it check how much data is loaded.If the data is loaded, make it scroll down.

 The pseudo code.
        check if data loaded
     if data loaded     - scroll down
          else
              (             )
       OK ??????
ASKER CERTIFIED SOLUTION
Avatar of henryww
henryww

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rascalpants
I don't think hauto whats the scroll bar to go directly to the end of the code, s/he just wants to be able to scroll... is that correct?


this page will give you some help:

http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary303.html


rp
yes, could be too ... thanks rp

//well, if so just do
scrollBar.setScrollTarget(_root.myText);

//and take the following line away
scrollBar.setScrollPosition(100000);

if that's case

cheers
Avatar of hauto

ASKER

Thanks for all your comment

I have tested the code from henryww, it works but but still a problem there,

When I put the henryww's code in the main timeline, I find the scrollbar only scroll to position 6, I have trace the maxroll out out and it only return me with the number of 6 (Actually I get 16 rows), how can I scroll to the bottom?

If I put the code under the OnClipEvent(data), I find no effect will be given out? why?

Maybe I tell you all what I am doing more detail, I have a text file generates every 10 sec, which looks like &variable=line%0dline%0dline%0d, the number of line in text file different every time, the content of the text file load into a dynamic text field and the scrollbar reference to the field will scroll to the bottom.

Cheers
So you do want to automatically scroll to the bottom...well at least that is where the scroller will start...


Why exactly do you want to do that?  Are you trying to hide your content or something...


you can just place a bunch of \n in a row at that end of your string variables that go in the text area...


hope that helps you out...


rp

u have to do this everytime whenever there is a change in the target textbox.

scrollBar.setScrollTarget(_root.myText);

are u targeting the variable or the textbox?

post ur code for the OnClipEvent(data)
that will help us to see what's problem there...

or give us a link to ur swf or fla :)

cheers
Here is an option, but I am not sure if this will work for pre-MX.

Make the dynamic textfield scrollable, Text > Scrollable.
Type the identifier of this textbox in the "Var" textfield.  For this example I will call it "text1."

After the text is loaded use can use the following line to make it scroll to the bottom:

text1.scroll = text1.maxscroll
Avatar of hauto

ASKER

rs,
the reason for scrolling is a practise allowing user to see the last line of the message.

henry,
my psuedo just like you, maybe the reason is due to the fact that the text file size is too bad that the swf can only ingest 6 lines in the onChip event, so even I trace out the maxscroll and I can only get the number of 6.
oh i see ...

if do have MX ... then u can use ocgstyles method.
if u have trouble loading the text in ... that's something to do with ur text file format. make sure u don't have "&" in the text file

like this won't work
myText=Hellow World & How are you?

it should be
myText=Hellow%20World%20%26%20How%20are%20you%3F

see if that helps

cheers