Created
December 30, 2014 15:55
-
-
Save hernanBeiza/9c568c9dd04a3b660658 to your computer and use it in GitHub Desktop.
AS3 - ScrollBar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public var sb:ScrollBar = new ScrollBar; | |
public var mcContenido:MovieClip; | |
public var mcMask:MovieClip; | |
private function configScroll():void { | |
//Config Scroll | |
//trace("Configurar Scroll"); | |
sb.x = 20+mcContenido.x + mcContenido.width; | |
sb.y = mcContenido.y; | |
sb.height = mcMask.height; | |
sb.enabled = true; | |
sb.setScrollProperties(mcMask.height, 0, (mcContenido.height-mcMask.height)); | |
sb.addEventListener(ScrollEvent.SCROLL, scrollMC); | |
addChild(sb); | |
} | |
private function scrollMC(event:ScrollEvent):void { | |
mcContenido.y=-event.position + mcMask.y; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment