A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: 100% actionscript scrollbar issue

  1. #1
    Junior Member
    Join Date
    Feb 2006

    100% actionscript scrollbar issue

    semi working flash movie:
    here is my fla:
    OK this is the most perplexing action script problem i have ever had. i am desperately trying to solve this problem. my scroller works, but goes up too far, and does not act correctly. if someone can point me in the right direction, i will be VERY happy. the whole entire script is contained within the main movie. there are no frames. just the clips, thats all.

    // ----------------
    // scroller.fla
    // murderd@gmail.com
    // ----------------
    // function to scroll any movieclip, based on soome input variables
    // myScrollable - movieclip to scroll
    // myMask - mask to be used for the scrollable movieclip
    // myScrollbar - scrollbar movieclip
    // myGutter - 'gutter' or bounding box for the scrollbar
    // a - speed for the scroller
    // d - damping for the scroller after being released
    // targY - new _y position for the scrollable movieclip
    // --------------------

    function justScrollIt(myScrollable:MovieClip, myMask:MovieClip, myScrollbar:MovieClip, myGutter:MovieClip, a:Number, d:Number, targY:Number) {
    // ------------------------------
    myYspeed = myScrollable._y;
    myScrollbar.useHandCursor = false;
    // the 'gutter' or bounding box which the scrollbar resides in
    // next version, 'myGutter' will be the bounding box, and these vars will be grabbed from there
    gutterLeft = myScrollbar._x;
    gutterTop = 0;
    //gutterTop = myGutter._y - (myGutter._height/2) + (myScrollbar._height/2);
    gutterRight = myScrollbar._x;
    gutterBottom = myGutter._y + (myGutter._height/2) - (myScrollbar._height/2);
    // ------------------------------
    myScrollbar.onPress = function(){
    startDrag(myScrollbar, false, gutterLeft, gutterTop, gutterRight, gutterBottom);
    //stop the drag
    myScrollbar.onRelease = REF.scrollbar_mc.onReleaseOutsi
    de = function() {
    // ------------------------------
    //set the mask for the text
    // ------------------------------
    myScrollable.onEnterFrame = function(){
    scrollAmount = (myScrollable._height - (myMask._height/1.3))/(myMask._height - myScrollbar._height);
    //set a new target y position
    targY =- myScrollbar._y * scrollAmount;
    myYspeed = ((Math.round(myScrollable._y) - Math.round(targY))/a+Math.round(myYspeed))/d;
    myScrollable._y -= myYspeed;
    // ------------------------------

    // call the scroller function
    justScrollIt(scrollable_mc, mask_mc, scrollbar_mc, gutter_mc, 8, 8, 0);

    -edward hotchkiss

  2. #2
    All 1s and 0s dmonkey's Avatar
    Join Date
    Nov 2005
    Leeds, UK

    I'm not quite sure what the effect you are going for with the scrollbar, but the reason why the scroll bar escapes the gutter at the top is because you have put:

    gutterTop = 0;

    and commented out the correct code:

    gutterTop = myGutter._y - (myGutter._height/2) + (myScrollbar._height/2);

    Un-comment this line and see what I mean.

    Could you say a but more about what you want the scroll bar to do?
    Last edited by dmonkey; 02-28-2006 at 02:57 PM.

  3. #3
    Junior Member
    Join Date
    Feb 2006

    well ..

    i just want the scroller actually work. for some reason, when the _root loads, the scrollable text just flies up. it shouldnt even move when the main timeline initializes. why does it do this?

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