?
Solved

Scrollbar problem

Posted on 2003-02-24
10
Medium Priority
?
6,690 Views
Last Modified: 2008-07-09
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
0
Comment
Question by:hauto
  • 4
  • 2
  • 2
  • +2
10 Comments
 

Expert Comment

by:olcorado
ID: 8014331
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 ??????
0
 
LVL 6

Accepted Solution

by:
henryww earned 60 total points
ID: 8016503
ha ha ... great work olcorado :)

but isn't this suppose to be the way it is... like start reading from the top ...

well, it that's for a chat board or something so u need to read the last line ...

if will have to do
"check if data loaded"
before as stated by olcorado

// the target again -so the scrollbar can recalculate the length, etc...
scrollBar.setScrollTarget(_root.myText);
// set a very vert large number to the positon
scrollBar.setScrollPosition(100000);

that way it will go to the end

cheers
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 8018244
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
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 6

Expert Comment

by:henryww
ID: 8018352
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
0
 

Author Comment

by:hauto
ID: 8022128
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
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 8025504
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
0
 
LVL 6

Expert Comment

by:henryww
ID: 8025622

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
0
 
LVL 5

Expert Comment

by:ocgstyles
ID: 8029247
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
0
 

Author Comment

by:hauto
ID: 8031329
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.
0
 
LVL 6

Expert Comment

by:henryww
ID: 8031393
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
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

616 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question