Skip to content

Instantly share code, notes, and snippets.

@hernanBeiza
Created December 30, 2014 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hernanBeiza/9c568c9dd04a3b660658 to your computer and use it in GitHub Desktop.
Save hernanBeiza/9c568c9dd04a3b660658 to your computer and use it in GitHub Desktop.
AS3 - ScrollBar
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