Jump to content
Search Community

Vortexroman

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by Vortexroman

  1. Hi Carl, here is the code I've used in my app:
    //Scroll

    private function createScroll():void {
    bounds = new Rectangle(43, 229, 552, (610+Math.round(deviceScreenHeight - baseScreenHeight)));

    blitMask = new BlitMask(buttons_container_mc, bounds.x, bounds.y, bounds.width, bounds.height, false);
    blitMask.disableBitmapMode();
    blitMask.addEventListener(MouseEvent.MOUSE_DOWN, scrollMouseDownHandler);
    }

    function scrollMouseDownHandler(event:MouseEvent):void {
    if ((canScrollButtons)&&(this.mouseY>229)&&(this.mouseY<(229+(610+Math.round(deviceScreenHeight - baseScreenHeight))))) {
    mouse_move = false;
    TweenLite.killTweensOf(buttons_container_mc);
    y1 = y2 = buttons_container_mc.y;
    yOffset = this.mouseY - buttons_container_mc.y;
    yOverlap = Math.max(0, buttons_container_mc.height - (bounds.height-15));
    t1 = t2 = getTimer();
    buttons_container_mc.stage.addEventListener(MouseEvent.MOUSE_MOVE, scrollMouseMoveHandler);
    buttons_container_mc.stage.addEventListener(MouseEvent.MOUSE_UP, scrollMouseUpHandler);
    }
    }

    function scrollMouseMoveHandler(event:MouseEvent):void {
    mouse_move = true;
    var y:Number = this.mouseY - yOffset;
    if (y > bounds.top) {
    buttons_container_mc.y = bounds.top;
    } else if (y < bounds.top - yOverlap) {
    buttons_container_mc.y = bounds.top - yOverlap;
    } else {
    buttons_container_mc.y = y;
    }
    blitMask.update();
    var t:uint = getTimer();
    event.updateAfterEvent();
    }

    function scrollMouseUpHandler(event:MouseEvent):void {
    buttons_container_mc.stage.removeEventListener(MouseEvent.MOUSE_UP, scrollMouseUpHandler);
    buttons_container_mc.stage.removeEventListener(MouseEvent.MOUSE_MOVE, scrollMouseMoveHandler);
    var time:Number = (getTimer() - t2) / 1000;
    var yVelocity:Number = (buttons_container_mc.y - y2) / time;
    ThrowPropsPlugin.to(buttons_container_mc, {throwProps:{
    y:{velocity:yVelocity, max:bounds.top, min:bounds.top - yOverlap, resistance:100}
    }, onUpdate:blitMask.update, ease:Expo.easeOut
    }, 100, 0.25, 0);

     

  2. Hi and welcome to the GreenSock forums,

     

    The code you have above is only needed IF you want the object you are dragging to be thrown based on the velocity of your drag. If you don't want the "throw" behavior just try removing the code you posted. 

     

    Thank you for your answer, but I can't just remove the code, because it's being used in many current project's classes. I guess I need a solution of how to set a ThrowPropsPlugin. Do you have an idea how to solve it?

     

    Thanks,

    Roman

  3. Hi,

    I have a small issue with my scroller withing my mobile app. The issue is if I'm pressing, holding and dragging (up or down to wanted position) in one action, and then lifting my finger - the scroll will continue the animation of scrolling. It's like it "stores acceleration" -  If my drag action is bigger, than the scroll will continue the animation more. 

     

    How can I disable this "after scroll" animation? I just want a smooth and linear scroll. Can someone help?

     

    Here is my current code:

     

    ThrowPropsPlugin.to(buttons_container_mc, {throwProps:{
               y:{velocity:yVelocity, max:bounds.top, min:bounds.top - yOverlap, resistance:100}
              }, onUpdate:blitMask.update, ease:Expo.easeOut
             }, 100, 0.25, 0);

     

    Best regards,

    Roman

×
×
  • Create New...