# AS3 - Giving an order to the timeline through a custom class

**URL:** https://forum.kirupa.com/t/as3-giving-an-order-to-the-timeline-through-a-custom-class/272215
**Category:** flash
**Created:** [October 3, 2008, 12:32am UTC](https://forum.kirupa.com/t/as3-giving-an-order-to-the-timeline-through-a-custom-class/272215 "2008-10-03T00:32:49Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Brent\_Summers](https://avatars.discourse-cdn.com/v4/letter/b/b19c9b/32.png) [@Brent\_Summers](https://forum.kirupa.com/u/Brent_Summers)
#### Post date: [October 3, 2008, 12:32am UTC](https://forum.kirupa.com/t/as3-giving-an-order-to-the-timeline-through-a-custom-class/272215/1 "2008-10-03T00:32:49Z")

</div>

I made a custom class to control navigation but I am having trouble getting the gotoAndStop to affect the time line.

Here is the custom class.  
package  
{

```
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.display.Stage

public class NavButton extends MovieClip
{
	public var _destination:String
	
	public function NavButton()
	{
		
		
		this.addEventListener(MouseEvent.CLICK, onClick);
		this.addEventListener(MouseEvent.ROLL_OVER, RollOver);
		this.addEventListener(MouseEvent.ROLL_OUT, RollOut);
	}
	
	public function onClick(event:MouseEvent):void
	{
		
		
		_destination = event.currentTarget.name;
		gotoAndStop(_destination);
		
	}
	
	private function RollOver(event:MouseEvent):void
	{
		trace("rollover");
		this.scaleX = 1.5;
		this.scaleY = 1.5;
	}
	
	private function RollOut(event:MouseEvent):void
	{
		trace("rollout")
		this.scaleX = 1;
		this.scaleY = 1;
	}
}

```

}

Thanks in advance!
