?
Solved

Scrollbar problem

Posted on 2003-02-24
10
Medium Priority
?
6,687 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

752 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