var mc:MovieClip; mc = attachMovie("myClip", "myClip", getNextHighestDepth()); mc.onEnterFrame = function():Void { if (this._currentframe == this._totalframes) { this.stop(); delete this.onEnterFrame; } };