A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Scrollbar component is it very dynaminc?

  1. #1
    Senior Member
    Join Date
    Jun 2001
    Posts
    104
    I can make the scroll bar component work fine if the data is in the text field when the movie is initialized, but if i put the data in the text field after the movie is initialized, and the text field was empty when it was initialized, the scrollbar component does not allow any scrolling. The slider and up and down arrows don't work? Am i missing something?


  2. #2
    Senior Member
    Join Date
    Jun 2002
    Posts
    145
    click on the scrollBar, look in the properties window and make sure that the Target Text Field is set.

    or

    use this script:

    myScrollBar.setScrollTarget(myTextBox);




    to make the scrollbar sit at the bottom of the text box use this in a clip event like enter frame.

    myScrollBar.setScrollPosition(myTextBox.maxscroll) ;

  3. #3
    NerdInside's Avatar
    Join Date
    May 2001
    Location
    Penguin Island
    Posts
    3,439
    Or you can just drag the scrollbar onto the text field and it will snap into place.

  4. #4
    Senior Member
    Join Date
    Jun 2002
    Posts
    145
    but you must have the 'snap' function on and even then it still doesnt work somtimes

  5. #5
    Senior Member
    Join Date
    Jun 2001
    Posts
    104
    here is the problem.. I really really can make the component scroll bar work when the data is in the text field IF THE DATA IS IN THE FIELD from the start!

    The problem is when i have dynamically added data to the field.

    For example, i have a scrollbar component linked to a BLANK text field, and everytime i click a button, i want to ADD information into the text field. As i add data and the text field begins to overflow the text field, the scrolling doesn't start working.

    After looking at the code, it seems, ( i could be wrong) that the scrolling decisions are made, when the component is initiallized, therefore, if the text is not in the box when it is initiallized, it thinks there is nothing to scoll.

  6. #6
    Senior Member
    Join Date
    Jun 2002
    Posts
    145
    maybe try setting them using an onClipEvent(enterFrame) handler?

  7. #7
    Junior Member
    Join Date
    Jun 2002
    Posts
    2
    Originally posted by jamesbooth97
    here is the problem.. I really really can make the component scroll bar work when the data is in the text field IF THE DATA IS IN THE FIELD from the start!

    The problem is when i have dynamically added data to the field.

    For example, i have a scrollbar component linked to a BLANK text field, and everytime i click a button, i want to ADD information into the text field. As i add data and the text field begins to overflow the text field, the scrolling doesn't start working.

    After looking at the code, it seems, ( i could be wrong) that the scrolling decisions are made, when the component is initiallized, therefore, if the text is not in the box when it is initiallized, it thinks there is nothing to scoll.
    Did you find a solution to the Dynamic text problem? If so, I'd be interested in knowing what it turned out to be!
    Thanks.

  8. #8
    Senior Member
    Join Date
    Jun 2001
    Posts
    104
    ok, looks like you have to call this method:

    scrollBar.setScrollProperties(5, 0, 15);

    look under Flash UI Components in the Reference for more info on this. But you must set the (5, 0,15) to whatever you need.


    that will get the scrollbar working, if you have added text to it after it was initiallized.

    If there is an easier way, someone let me know..

  9. #9
    Senior Member
    Join Date
    Jun 2001
    Posts
    104
    Well, I found an easier way.. all you have to do is put the information into the instance names property.

    for examplewith myinstancename being the instance name of the text field and "text" being a property of the dynamic text field)



    myinstancename.text = "blah blah blah what ever you want"

    that will activate the scroll bars in the component (if there is enough data to require scrolling).

    the incorrect way to do it is the way we used to do it in flash 5, by sticking the info directly into the variable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center