# Sailing on the scrollbar high seas and have a question or two

**URL:** <https://forum.kirupa.com/t/sailing-on-the-scrollbar-high-seas-and-have-a-question-or-two/318851>\
**Category:** flash\
**Created:** [February 1, 2011, 2:01pm UTC](https://forum.kirupa.com/t/sailing-on-the-scrollbar-high-seas-and-have-a-question-or-two/318851 "2011-02-01T14:01:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chilldog](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@chilldog](https://forum.kirupa.com/u/chilldog)\
**Post date:** [February 1, 2011, 2:01pm UTC](https://forum.kirupa.com/t/sailing-on-the-scrollbar-high-seas-and-have-a-question-or-two/318851/1 "2011-02-01T14:01:18Z")

</div>

I’m trying to get a playhead to move across a grid, when it reaches the maximum space of the mask covering the grid I want the playhead to automatically scroll the scrollbar. Right now, the playhead will move to the end of a specified area and go back to the beginning of the grid but will not scroll. I’m stuck because it all involves using events and I can’t figure out how to pass an event to another event (if that’s even possible). The code that scrolls the scroll bar by user interaction is: (and mc is the name of the content that is to be scrolled)

```auto

function scrollMCHoriz(event:ScrollEvent):void{
	mc.x = -event.position + mcMask.x;
}

```

and the playhead (enter frame event) code is as follows:

```auto

function onPlayHeadMove(event:Event):void {
	playHead.x += 10;
	if ((playHead.x - 100) >= mcMask.width) {

	}
	else if ((playHead.x - 100) >= mc.width) {
		playHead.x = mc.x;
	}
}

```

This code:

```auto
	
if ((playHead.x - 100) >= mcMask.width) {

}

```

is where I want the scrollbar to automatically scroll. But I can’t use mc.x = **-event.position** + mcMask.x; in that code above anywhere because it throws a runtime error.

The error is 1119: Access of possibly undefined property position through a reference with static type flash.events:Event.

Thanks for your help.
