-
Ryan Thomson
levels of recursion were exceeded
hey all, im working on redesigning an old flash game for my work and notice i get an infinite loop error if i try to preview the movie twice in a row.. I'm pretty sure it has something to do with the code below, anyone perhaps know of a workaround?
Code:
MovieClip.prototype.gotoAndStopOld = MovieClip.prototype.gotoAndStop;
MovieClip.prototype.gotoAndStop = function (frame){
if (typeof (frame) == "string") this._currentlabel = frame;
this.gotoAndStopOld (frame);
}
MovieClip.prototype.gotoAndPlayOld = MovieClip.prototype.gotoAndPlay;
MovieClip.prototype.gotoAndPlay = function (frame){
if (typeof (frame) == "string") this._currentlabel = frame;
this.gotoAndPlayOld (frame);
}
ps this is outputted for flash6
thanks in advance!
-
Ryan Thomson
I found lots of other people with this problem (gotoAndStopOld = gotoAndStop and recursion issues) , nobody has any answers though... +_+
hopefully someone can point me in the right direction
-
Well, your problem is that you are setting gotoAndPlayOld=gotoAndPlay. So everytime you call gotoAndPlay, it calls gotoAndPlayOld, which is really just a reference back to itself, hence the infinite loop...
Same deal with gotoAndStopOld...
K.
-
Ryan Thomson
yeah that's what I figured, but this isn't my code and I'm not framiliar with prototype or really this style of coding in general so im not sure how to remedy this. I'm thinking what's happening is that when gotoAndStop is called it stores that in gotoAndStopOld but im not sure why.. man i hate trying to decipher other peoples code lol especially OLD code.. thanks for confirming that this is probably the problem 
If anyone can think of a way to recode this i would be most appreciative.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|