Quote:
Originally posted by ssjogus
from the photo you are looking very senior person. are you that much senior member?
about tutorial trying to understand it.
shruti.
|
I am indeed highly senior. I'm having a senior moment right now, in fact. Where did I put my teeth....
re that code, it could be quite difficult to understand if you're new to it.....basically movieclips don't have an inbuilt method that makes them go backwards so you have make your own. They do, however, have a method called prevFrame that sends them to, erm, the previous frame, so we can use that, and an event called enterFrame, which happens every time they, erm, enter a frame

so combining the two you have:
ActionScript Code:
my_mc.onEnterFrame = function() {
this.prevFrame();
}
if you put this code on frame one of a movieclip nothing would happen, cos there is no *previous frame* - so you might want to say "if you are on the first frame, start at the last frame and go backwards:
ActionScript Code:
my_mc.onEnterFrame = function() {
this._currentframe == 1 ? this.gotoAndStop(this._totalframes) : this.prevFrame();
}
cos all movieclips have properties called _currentframe and _totalframes which we can use.....
but apply this to a clip and it will *always* go backwards. With flash mx you can apply and remove eventhandlers so you could go:
ActionScript Code:
movieclip.prototype.playBackwards = function(arg){
if(arguments.length>0) {
this.onEnterFrame= undefined;
this.play();
} else {
this.onEnterFrame = function() {
this._currentframe == 1 ? this.gotoAndStop(this._totalframes) : this.prevFrame();
}
}
}
........it might seem that all of a sudden it all got a lot more complicated but here we just add a method to all movieclips that can be used to apply and remove the code in the first example.......and you would call this with my_mc.playBackwards() and stop it with my_mc.playBackwards(false).....but it has the big disadvantage that the clip in question can't have any other enterFrame handler applied to it........incidentally the example I linked to earlier is prolly smarter/neater cos most things from that site are
have attached a version of this working