Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Scrollbar help

Explorer ,
Nov 06, 2018 Nov 06, 2018

Im looking to convert this scrollbar code from action script 2 to action script 3 with and mouse wheel scroll and mouse click on scrollbar to get the movie clip to that place please,

here is the code for my action script 2 :

scrolling = function () {

    var scrollHeight:Number = scrollTrack._height;

    var contentHeight:Number = dyk_bk_main._height;

    var scrollFaceHeight:Number = scrollFace._height;

    var maskHeight:Number = maskedView._height;

    var initPosition:Number = scrollFace._y=scrollTrack._y;

    var initContentPos:Number = dyk_bk_main._y;

    var finalContentPos:Number = maskHeight-contentHeight+initContentPos;

    var left:Number = scrollTrack._x;

    var top:Number = scrollTrack._y;

    var right:Number = scrollTrack._x;

    var bottom:Number = scrollTrack._height-scrollFaceHeight+scrollTrack._y;

    var dy:Number = 0;

    var speed:Number = 10;

    var moveVal:Number = (contentHeight-maskHeight)/(scrollHeight-scrollFaceHeight);

   

    scrollFace.onPress = function() {

        var currPos:Number = this._y;

        startDrag(this, false, left, top, right, bottom);

        this.onMouseMove = function() {

            dy = Math.abs(initPosition-this._y);

            dyk_bk_main._y = Math.round(dy*-1*moveVal+initContentPos);

        };

    };

    scrollFace.onMouseUp = function() {

        stopDrag();

        delete this.onMouseMove;

    };

    btnUp.onPress = function() {

        this.onEnterFrame = function() {

            if (dyk_bk_main._y+speed<maskedView._y) {

                if (scrollFace._y<=top) {

                    scrollFace._y = top;

                } else {

                    scrollFace._y -= speed/moveVal;

                }

                dyk_bk_main._y += speed;

            } else {

                scrollFace._y = top;

                dyk_bk_main._y = maskedView._y;

                delete this.onEnterFrame;

            }

        };

    };

    btnUp.onDragOut = function() {

        delete this.onEnterFrame;

    };

    btnUp.onRelease = function() {

        delete this.onEnterFrame;

    };

    btnDown.onPress = function() {

        this.onEnterFrame = function() {

            if (dyk_bk_main._y-speed>finalContentPos) {

                if (scrollFace._y>=bottom) {

                    scrollFace._y = bottom;

                } else {

                    scrollFace._y += speed/moveVal;

                }

                dyk_bk_main._y -= speed;

            } else {

                scrollFace._y = bottom;

                dyk_bk_main._y = finalContentPos;

                delete this.onEnterFrame;

            }

        };

    };

    btnDown.onRelease = function() {

        delete this.onEnterFrame;

    };

    btnDown.onDragOut = function() {

        delete this.onEnterFrame;

    };

   

    if (contentHeight<maskHeight) {

        scrollFace._visible = false;

        btnUp.enabled = false;

        btnDown.enabled = false;

    } else {

        scrollFace._visible = true;

        btnUp.enabled = true;

        btnDown.enabled = true;

    }

};

scrolling();

429
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 08, 2018 Nov 08, 2018

Hi. Which portion of the code do you need help translating?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 08, 2019 Jan 08, 2019
LATEST

thanks for the help but i kept using as2 instead it was for the whole thing

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines