all groups > flash actionscript > april 2006 >
You're in the

flash actionscript

group:

Can Actionscript play a RANGE of frames?



Can Actionscript play a RANGE of frames? Angyl
4/9/2006 8:11:50 PM
flash actionscript: What's the Actionscript that would tell a movieclip named ballOne, for example to

on(release)
this.gotoAndPlay(2);

Re: Can Actionscript play a RANGE of frames? abeall
4/10/2006 12:47:45 AM
There's no built in way to do this. You will have to write a special script...
perhaps use nextFrame() in an onEnterFrame:
this.gotoAndStop(2);
onEnterFrame = function(){
if(_currentframe==18)delete onEnterFrame;
nextFrame();
}

Or wrap it in a prototype...

MovieClip.prototype.gotoAndPlayTo = function(goto, end) {
this.gotoAndStop(goto);
this.onEnterFrame = function () {
if (this._currentframe == end) delete this.onEnterFrame;
this.nextFrame();
}
}

... so you can simply do:

on(release){
this.gotoAndPlayTo(2,18);
}
AddThis Social Bookmark Button