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;
}
}
}