# MC advances past its max y position. How do I fix this?

**URL:** https://forum.kirupa.com/t/mc-advances-past-its-max-y-position-how-do-i-fix-this/295042
**Category:** flash
**Created:** [August 24, 2009, 5:55pm UTC](https://forum.kirupa.com/t/mc-advances-past-its-max-y-position-how-do-i-fix-this/295042 "2009-08-24T17:55:48Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Pietro\_2003](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@Pietro\_2003](https://forum.kirupa.com/u/Pietro_2003)
#### Post date: [August 24, 2009, 5:55pm UTC](https://forum.kirupa.com/t/mc-advances-past-its-max-y-position-how-do-i-fix-this/295042/1 "2009-08-24T17:55:48Z")

</div>

Hej,

I have a scroller mc that I want to control by clicking underneath its y position to advance it down its y axis by a predetermined amount. The below code works to move it, but it advances past its max value of 496.5 (off the screen).

Have I made a mistake in the code below? The scroller mc and associated text block is in their own mc on the root timeline. This code is on a frame on the root timeline.

Has it got to do with the relative y positions of the stage compared with the y positions in the actual MC that I am trying to control?

Any help greatly accepted. Cheers.

```auto
principals_mc.johnTxt_mc.scrollerZone_mc.onRelease = function () {

    var scrollerAmount:Number = 80;
    
    if (this.hitTest(principals_mc.johnTxt_mc.jfscroller_mc)) {
    
        if (_ymouse>principals_mc.johnTxt_mc.jfscroller_mc._y+principals_mc.johnTxt_mc.jfscroller_mc._height)
        {
            //Mouse is below the scroller thumbnail
            if (principals_mc.johnTxt_mc.jfscroller_mc._y<496.5)
            {
                principals_mc.johnTxt_mc.jfscroller_mc._y+=scrollerAmount;
                trace(principals_mc.johnTxt_mc.jfscroller_mc._y);
            }
            else
            {
                principals_mc.johnTxt_mc.jfscroller_mc._y=496.5;
            }
                jfScroll(); // function updates text block that scrolles according to jfscroller_mc position
    }
}

```
