# AS3 Draggable layer/mask on y axis

**URL:** <https://forum.kirupa.com/t/as3-draggable-layer-mask-on-y-axis/518064>\
**Category:** flash\
**Created:** [February 3, 2015, 8:50pm UTC](https://forum.kirupa.com/t/as3-draggable-layer-mask-on-y-axis/518064 "2015-02-03T20:50:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![djjulia](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@djjulia](https://forum.kirupa.com/u/djjulia)\
**Post date:** [February 3, 2015, 8:50pm UTC](https://forum.kirupa.com/t/as3-draggable-layer-mask-on-y-axis/518064/1 "2015-02-03T20:50:08Z")

</div>

I’d like to create this exact example: [http://www.nytimes.com/2008/12/28/nyregion/18thennow.html?\_r=2&](http://www.nytimes.com/2008/12/28/nyregion/18thennow.html?_r=2&) however have the drag occur on the y axis instead of the x. I was working with some basic code, but wondering how to lock it in place?

```
myImage.mask = myMask;
stage.addEventListener(MouseEvent.MOUSE_DOWN, fMouseDown);
stage.addEventListener(MouseEvent.CLICK, fMouseUp);
function fMouseDown(e:MouseEvent):void {
myMask.startDrag();
}
function fMouseUp(e:MouseEvent):void {
myMask.stopDrag();
}

```

It isn’t quite what I need though, any help? Thanks in advance!
