A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: scroll bar component prob

  1. #1
    FK M.D. pheck's Avatar
    Join Date
    Jul 2001
    Location
    MN
    Posts
    807
    hi,

    i just threw in a scroll bar using flash mx for the first time in my prototype guest book:

    http://doctoredmedia.t35.com/GuestBook/GuestBook.swf

    (cut and paste URL as it is a free host and will forward you to their homepage if clicked directly)

    I've had to add a bunch of returns in the original dynamic text field in order to get a thumbnail for scrolling down. it was my belief that the scrollbar was smart and was able to 'know' how much text is loaded into the text field from a text file, and create the thumb dynamically based on this.

    does anyone know any workarounds to this? why it is doing this? or should i just leave it as is. thanks.

  2. #2
    Senior Member
    Join Date
    Jun 2000
    Posts
    705
    well its almost smart. It dicedes how long it is the first time it loads. You can force it to reset however. The same problem occurs when you try loading text from a text file. I have a file you can download with the fix at:
    http://www.geckoarts.com
    in scriptlab >flash6 >f01
    I'd write the code, but forget the entire thing.
    I tried looking at your link. Didn't see the guestbook, but hey I tried that contest for the free xbox.

  3. #3
    FK M.D. pheck's Avatar
    Join Date
    Jul 2001
    Location
    MN
    Posts
    807
    thanks frank....looking at it now.

  4. #4
    FK M.D. pheck's Avatar
    Join Date
    Jul 2001
    Location
    MN
    Posts
    807
    frank,

    thanks for the idea, but it's not working.

    1st, you have an empty zip download for that link on your site.

    2nd, here's the code i surmise you used (the original code in your textbox is missing a few closing brackets as best I could tell):

    Code:
    onClipEvent(load){
    	on(press){
    		loadText=new LoadVars();
    		loatText.load("GuestBook.txt");
    		loadText.onLoad=function(done){
    			if(done){
    				myscroll.setScrollPosition(0);
    				mytext.text=this.mytext;
    			}
    		}
    	}
    }
    but then when I test the movie it says "on handlers may not nest within other on handlers
    on(press){"

    any thoughts? thanks. oh, BTW, i assume you put the code onto the instance of the scroll bar component, right?

  5. #5
    Senior Member
    Join Date
    Jun 2000
    Posts
    705
    Actualy I added this script to the button that loading the text.
    on (press) {
    loadText = new LoadVars();
    loadText.load("text1.txt");
    loadText.onLoad = function(done) {
    if (done) {
    myscroll.setScrollPosition(0);
    mytext.htmltext = this.mytext;
    }
    };
    }
    where your scrollbar is named "myscroll"

    not sure if it will fix your guestbook, but it sounds like the same problem.
    Thanks for letting me know about the zip. It must have been n older one. I put up a new one with all the files.
    Thanks

  6. #6
    FK M.D. pheck's Avatar
    Join Date
    Jul 2001
    Location
    MN
    Posts
    807
    well, thanks for that.

    here's what i have for code

    NumLow = 0;
    NumHigh = 10;
    loadVariablesNum ("GuestBook.php?NumLow="+NumLow+"&NumHigh="+NumHig h+"&R="+random(999), 0);
    stop();

    i thought about adding the

    myscroll.setScrollPosition(0);
    mytext.htmltext = this.mytext;

    lines after the loadVariablesNum line, but this didn't work (only loaded correctly first time page was viewed...then when more entries it didn't budge)

    anyother ideas? thanks so much!

  7. #7
    Senior Member
    Join Date
    Jun 2000
    Posts
    705
    hum
    the key when loading from text files was just using:
    myscroll.setScrollPosition(0);
    after the text loaded.
    perhaps if there is a way to determine when your text has changed. you might be able to this afterwards.
    sorry, can't think think of much else

  8. #8
    Maya * ActionScript Addict DangerAhead's Avatar
    Join Date
    Jun 2000
    Location
    San Francisco
    Posts
    299
    just call the public method from the target clip:

    if it's a ScrollPane Component, this will refresh the scroll bar size to the new "visible area" size if you're using a scroll pane:

    I'm not sure about the scroll text Component


    Code:
    nameOfYourScroller.refreshPane();
    look for the Class code somewhere inside the component.
    should look like this:
    Code:
    FScrollPaneClass.prototype.refreshPane = function()
    {
    	this.setScrollContent(this.content_mc);
    }
    good luck

  9. #9
    FK M.D. pheck's Avatar
    Join Date
    Jul 2001
    Location
    MN
    Posts
    807
    thank you.

    will give this a go.


  10. #10
    FK M.D. pheck's Avatar
    Join Date
    Jul 2001
    Location
    MN
    Posts
    807
    still no luck.

    thanks to you all for your help, but i'm still stuck. I've tried refreshpane and that don't work either. any other ideas out there? thanks.

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