dcsimg
A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: [F8] How to reset UIScrollbar?

  1. #1
    Senior Member
    Join Date
    Feb 2004
    Posts
    133

    [F8] How to reset UIScrollbar?

    Hi, guys!

    I´ve got this project in which I have a single swf file which loads external txts in a single dynamic textfield box through buttons. So, let´s say, I click on "Home" Button and home.txt gets loaded inside my dynamic textfield. If I click on "products" button, products.txt gets loaded and so on...

    So, as you can see, all txt files load fine. The problem is that whenever I scroll the txt using flash UIScrollbar standard component the next loaded txt will load already scrolled, when it is supposed to load showing its first line...

    So, I think that there must be a way to reset the scrollbar (or the textfield for this matter) so that when you load the next txt file it will be displayed correctly...

    Can any of you guys give me a hand here?

    Thanks in advance!

  2. #2
    Senior Member
    Join Date
    Feb 2004
    Posts
    133
    BumP!

    Please... any help will be much appreciated!...

    Thanks!

  3. #3
    Senior Member
    Join Date
    Feb 2004
    Posts
    133
    Still hoping for some help...

  4. #4
    girasquid.com
    Join Date
    Mar 2007
    Location
    127.0.0.1
    Posts
    18
    Have you tried re-enabling the scrollbar each time you fill the textfield? You would do this like so:
    Code:
    myScrollbarName.enabled = true;

  5. #5
    Senior Member
    Join Date
    Feb 2004
    Posts
    133
    Thanks... but it didnt work... I am currently taking a look at setscrollposition (with no look also...)

  6. #6
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    I never figured this out; I just put the scrollbar and textfield into a movie clip, and made the movie clip go to a blank frame and back to reset everything.
    http://www.birchlabs.co.uk/
    You know you want to.

  7. #7
    Senior Member
    Join Date
    Feb 2004
    Posts
    133
    VengeanceMX,

    I feel that your idea might work... but I couldn´t make it work... I´ll post the code to see if some idea comes up... To make things more clear, keep in mind that I´ve got two dynamic textboxes (one is called "txtmiolo" and the other is "txttitle") that are populated loading one external txt file. Besides that, those two textfields are inside movieclips "ani_base_txt" and "base_txt".

    Thanks in advance... any help will be much appreciated...

    //********************************************
    //TEXT CODE
    //********************************************
    var myLV:LoadVars = new LoadVars();
    myLV.onLoad = function(success) {
    if (success) {
    ani_base_txt.base_txt.createClassObject(mx.control s.UIScrollBar, "myScrollBar", ani_base_txt.base_txt.getNextHighestDepth());
    ani_base_txt.base_txt.myScrollBar.setScrollTarget( ani_base_txt.base_txt.txtmiolo);
    ani_base_txt.base_txt.myScrollBar.setSize(16, ani_base_txt.base_txt.txtmiolo._height);
    ani_base_txt.base_txt.myScrollBar.move(ani_base_tx t.base_txt.txtmiolo._x+ani_base_txt.base_txt.txtmi olo._width+5, ani_base_txt.base_txt.txtmiolo._y);
    placeText(this);
    }
    };
    myLV.load("txt/real/txt_home.txt");
    //
    _global.loadText = function(pathToText:String) {
    var myLV:LoadVars = new LoadVars();
    myLV.onLoad = function(success) {
    if (success) {
    placeText(this);
    }
    };
    myLV.load(pathToText);
    };
    function placeText(theLV:LoadVars) {
    ani_base_txt.base_txt.txtmiolo.htmlText = theLV.txtmiolo;
    ani_base_txt.base_txt.txttitle.htmlText = theLV.txttitle;
    if (ani_base_txt.base_txt.txtmiolo.maxscroll>ani_base _txt.base_txt.txtmiolo.bottomScroll) {
    ani_base_txt.base_txt.myScrollBar._visible = true;
    //myScrollBar.ani_base_txt.base_txt.txtmiolo.scroll = 0;
    } else {
    ani_base_txt.base_txt.myScrollBar._visible = false;
    }
    }

  8. #8
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    Just tell ani_base_txt to go to frame 2 (and make sure frame 2 of it is blank), then go back to frame 1. Scrollbar will be reset.
    http://www.birchlabs.co.uk/
    You know you want to.

  9. #9
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    edit - code was for scrollpane

    for UIScrollbar use - UIScrollBar.scrollPosition
    Last edited by a_modified_dog; 04-14-2007 at 05:02 AM.

  10. #10
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    attached is a test file,
    to reset the scrollbar (scrBar2) was simply a matter of setting
    the scroll position of the textfield (sub_txt) to zero.

    hth

    please let me know when you have D/L'd the file
    so I can delete it to make space in my FK stash

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