# Class extends MovieClip (how do I modify events?)

**URL:** <https://forum.kirupa.com/t/class-extends-movieclip-how-do-i-modify-events/46555>\
**Category:** flash\
**Created:** [March 25, 2004, 4:56pm UTC](https://forum.kirupa.com/t/class-extends-movieclip-how-do-i-modify-events/46555 "2004-03-25T16:56:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrand01](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@mrand01](https://forum.kirupa.com/u/mrand01)\
**Post date:** [March 25, 2004, 4:56pm UTC](https://forum.kirupa.com/t/class-extends-movieclip-how-do-i-modify-events/46555/1 "2004-03-25T16:56:59Z")

</div>

I’m trying to modify the onPress and onRelease events for a movieclip linked to this class. It isn’t working, so I must be doing something wrong. I marked the lines where I’m trying to modify these events. Any ideas?

```auto

class PPSlide extends MovieClip {
	var strSlideTitle:String;
	var strSlideNumber:String;
	var strFileName:String;
	
	var txtSlideTitle:mx.controls.Label;
	var txtSlideNumber:mx.controls.Label;
	var txtFileName:mx.controls.Label;
	var mcPreviewImage:MovieClip;
	
	var origX:Number;
	var origY:Number;
	var highDepth:Number;
	
	function PPSlide() {
		this.strSlideTitle = strSlideTitle;
		this.strSlideNumber = strSlideNumber;
		this.strFileName = strFileName;
		
		this.txtSlideTitle.text = this.strSlideTitle;
		this.txtSlideNumber.text = "Slide " + this.strSlideNumber;
		this.txtFileName.text = this.strFileName;
		this.mcPreviewImage.loadMovie(this.strFileName);
		
		function onPress() { //won't work
			this.startDrag();
			origX = this._x;
			origY = this._y;
			highDepth = this.getNextHighestDepth();
			this.swapDepths(highDepth);
		}
		
		function onRelease() { //won't work
			this.stopDrag();
			this._x = origX;
			this._y = origY;
		}
	}
}

```

EDIT: I tryed this also (with no success):

```auto

class PPSlide extends MovieClip {
	var strSlideTitle:String;
	var strSlideNumber:String;
	var strFileName:String;
	
	var txtSlideTitle:mx.controls.Label;
	var txtSlideNumber:mx.controls.Label;
	var txtFileName:mx.controls.Label;
	var mcPreviewImage:MovieClip;
	
	var origX:Number;
	var origY:Number;
	var highDepth:Number;
	
	function PPSlide() {
		this.strSlideTitle = strSlideTitle;
		this.strSlideNumber = strSlideNumber;
		this.strFileName = strFileName;
		
		this.txtSlideTitle.text = this.strSlideTitle;
		this.txtSlideNumber.text = "Slide " + this.strSlideNumber;
		this.txtFileName.text = this.strFileName;
		this.mcPreviewImage.loadMovie(this.strFileName);
		
		onPress = doDrag();
		onRelease = doDrop();
	}
	
	private function doDrag() {
		this.startDrag();
		origX = this._x;
		origY = this._y;
		highDepth = this.getNextHighestDepth();
		this.swapDepths(highDepth);
	}
		
	private function doDrop() {
		this.stopDrag();
		this._x = origX;
		this._y = origY;
	}
}

```
