Simple ScrollBar

I would like to share my simple scroll bar AS2 component which you can use in your old projects download SimpleScrollBar.zip (17.81 KB)

20 Responses

  1. John Says:

    great !

  2. ronald Says:

    thanks! big help..

  3. rex Says:

    hi,

    how about horizontal scrollbar? how to implement with this component.

    thanks

  4. Antonos Says:

    very simple:
    var scroll_c = ref.attachMovie(”ScrollBar”,”scroll_mc”,1,{_x:ref.mask_mc._x,_y:ref.mask_mc._y + ref.mask_mc._height});
    scroll_c.setHeight(ref.mask_mc._height);

    scroll_c.PageSize = ref.mask_mc._width;
    scroll_c.McHeight = ref.content_mc._width+40;
    scroll_c.Chunks = ref.content_mc._width+40-ref.mask_mc._width;

    scroll_c._rotation = -90;
    scroll_c._parent.onScroll = function()
    {
    ref.content_mc._x = ref.mask_mc._x - this.scroll_mc.getScrollPos();
    }

    scroll_c.init();

    scroll_c.onPress = function(){}

  5. Federico Says:

    I found a bug, when you have more than 1 frame, the scroll bar appears on every frame after. Is there a way to not have this happen?

    Thanks

  6. Federico Says:

    Nevermind…I used:
    removeMovieClip(”scroll_mc”);

  7. max Says:

    Hello and thank you for this script. I’ve spent a lot of time messing with scrollers but I always get tired of how they look, or find they look tired.

    Your script is great, however I have multiple frames inside the content_mc, each frame has a dynamic text field which has a different height.

    I am looking for a way to re-size the content_mc from each frame inside. I have made little progress, as I have only managed to stretch the content.

    Thank you for reading this and I would really appreciate any pointers you might have

    Thanks
    Max

  8. Jun Says:

    how about adding some easing when dragging the scroller? how to implement thid functionality?…

    Thanks,

  9. Angela Says:

    What I have to do, if I want to repeat the same scroll in te same swf, but different content, what I have to change, I have benn trying that for weeks,
    Please help, tks!!

  10. Laura Says:

    Hi, could you let me know how can I make the scrolling go “faster” when the arrows are clicked, I find it’s too slow and I’m really no expert in code. I’d appreciate your help, thanks!!

  11. Antonos Says:

    hi guys,
    sorry for delay, was busy last weeks

    Jun, for example you can use TweenLite for that
    http://www.greensock.com/tweenlite/

    code to implement:

    import com.greensock.*;
    //…….
    scroll_c._parent.onScroll = function()
    {
    TweenLite.to(ref.content_mc, 1, {_y:ref.mask_mc._y - this.scroll_mc.getScrollPos()});
    }

    Angela, to put one more instance of scrollbar to stage you will have to add mask for each content and put different names, e.g. mask1_mc, mask2_mc etc.
    than when you attach scroll set different names for each scroll
    var scroll1_c = ref.attachMovie(”ScrollBar”,”scroll1_mc”,1,{_x:ref.mask1_mc._x+ref.mask1_mc._width-10,_y:ref.mask1_mc._y});
    than onScroll event change position of corresponding content holders
    scroll1_c._parent.onScroll = function(){ ref.content1_mc._y = ref.mask1_mc._y - this.scroll1_mc.getScrollPos();
    }

    Laura, you can make scrolling faster by increasing you frame rate (in this case scrolling will be smoother and faster but it will affect CPU) or you can play with PageSize,McHeight and Chunks parameters (but it will make scrolling coarser)

  12. Antonos Says:

    Max, you have to change McHeight and Chunks parameters for each content you are scrolling

  13. Clone Says:

    Hi, thanks for the great script.
    I’m trying to add mouse wheel support, but can’t seam to manage it.
    Any way this can be accomplished?

  14. Clone Says:

    Managed to do it, not hard and someone might need it:

    var mouseListener = new Object();
    mouseListener.onMouseWheel = function( wheelMotion ){
    scroll_c.scr_pos -= wheelMotion *2;
    scroll_c.Update();
    }

    Mouse.addListener( mouseListener );

  15. Peter Says:

    Regarding the question of August 19th 2009: …when you have more than 1 frame, the scroll bar appears on every frame after. Is there a way to not have this happen?

    Frederico said: I used:
    removeMovieClip(”scroll_mc”);

    Could you please explain precisely where do you stick that ActionScript?
    Thanks a lot!

  16. Matt Says:

    Hey, thanks a lot for this component, it’s great!

    Like Laura allready mentioned, I would like to get faster scrolling when clicking on the arrow buttons.

    I tried to change PageSize, McHeight and Chunks, but couldn’t get it scroll faster.

    Can you give me further instructions on how to change those parameters?

    Thank you very much…

  17. Rodrigo Says:

    Hello, like other user, i would to make the scroller faster when click on arrows… and also… how can i use the mouse wheel? Thanks and congratulations for your script!!

  18. Melas Says:

    hi!
    i did like this:

    one more instance of scrollbar to stage you will have to add mask for each content and put different names, e.g. mask1_mc, mask2_mc etc.
    than when you attach scroll set different names for each scroll
    var scroll1_c = ref.attachMovie(”ScrollBar”,”scroll1_mc”,1,{_x:ref.mask1_mc._x+ref.mask1_mc._width-10,_y:ref.mask1_mc._y});
    than onScroll event change position of corresponding content holders
    scroll1_c._parent.onScroll = function(){ ref.content1_mc._y = ref.mask1_mc._y - this.scroll1_mc.getScrollPos();
    }

    var mouseListener = new Object();
    mouseListener.onMouseWheel = function( wheelMotion ){
    scroll1_c.scr_pos -= wheelMotion *2;
    scroll1_c.Update();
    }

    Mouse.addListener( mouseListener );

    it doesn’t work alone, it makes all scroll work together.

    how can i do to work alone?

    thanks in advance.
    MELAS

  19. ajay Says:

    thanks

  20. Gabriel Says:

    Exelente!

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.