# This.onEnterFrame, is not a property error

**URL:** <https://forum.kirupa.com/t/this-onenterframe-is-not-a-property-error/145507>\
**Category:** Uncategorized\
**Created:** [April 22, 2005, 11:19pm UTC](https://forum.kirupa.com/t/this-onenterframe-is-not-a-property-error/145507 "2005-04-22T23:19:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thewebgremlin](https://avatars.discourse-cdn.com/v4/letter/t/b5e925/32.png) [@thewebgremlin](https://forum.kirupa.com/u/thewebgremlin)\
**Post date:** [April 22, 2005, 11:19pm UTC](https://forum.kirupa.com/t/this-onenterframe-is-not-a-property-error/145507/1 "2005-04-22T23:19:24Z")

</div>

Hi there,

I have just started scripting in flash, and i have created my first class, but the error:

There is no property with the name ‘onEnterFrame’.  
this.onEnterFrame = function (){

keeps on occurring when i de bug, i though this was how you assigned a onenterframe to a function. Please could someone have a look and le me know why the error occurs

many thanks

Jamo

#class PictureViewer {  
private var Status:String = ‘Closed’;  
private var OpenXpos:Number = 0;  
private var CloseXpos:Number = 0;  
private var DisplayXpos:Number = 0;  
private var OpenSpeed:Number = 0;  
private var CloseSpeed:Number = 0;

function PictureViewer(SXpos:Number,SYpos:Number,OXPos:Number,CXPos:Number,DXpos:Number,OSpeed:Number,CSpeed:Number,St:String){  
this.Status = St;  
this.OpenXpos = OXPos;  
this.CloseXpos = CXPos;  
this.DisplayXpos = DXpos;  
this.OpenSpeed = OSpeed;  
this.CloseSpeed = CSpeed;  
this.Status = ‘Closed’;

}

//the open function moves the viewer to the open position depicted in the OPos property  
function OpenMe() {  
this.onEnterFrame = function (){  
if (this.\_x \< this.OpenXpos) {  
this.\_x += (this.OpenXpos-this.\_x)/this.OpenSpeed;  
}  
if (Math.round(this.\_x) == this.OpenXpos+1) {  
this.Status = ‘Opened’;  
stop();  
}  
}

function Close(){  
this.onEnterFrame = function (){  
if (this.\_x\>this.CloseXpos) {  
this.\_x += (this.CloseXpos-this.\_x)/this.CloseSpeed;  
}  
//check if current xpos = Picture1\_OpenXpos  
if (Math.round(this.\_x) == this.CloseXpos) {  
this.Status = ‘Closed’;  
stop();  
}  
}  
}

function Display(){  
this.onEnterFrame = function(){  
if (this.\_x\<this.DisplayXpos) {  
this.\_x += (this.DisplayXpos-this.\_x)/this.OpenSpeed;  
}  
//check if current xpos = Picture1\_OpenXpos, set to opened  
if (Math.round(this.\_x) == this.DisplayXpos) {  
//send the controller clip to frame 1, which will tell the text box to expand  
\_root.McControl.gotoAndStop(2);  
this.Status = ‘Displayed’;  
stop();  
}  
}  
}

function Reset(){  
this.onEnterFrame = function(){  
if (this.\_x\>this.CloseXpos) {  
this.\_x += (this.CloseXpos-this.\_x)/this.CloseSpeed;  
}  
if (Math.round(this.\_x) == this.CloseXpos) {  
this.Status = ‘Open’;  
stop();  
}

}  
}

function stop(){  
delete this.onEnterFrame;  
}

}  
}
