A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: levels of recursion were exceeded

  1. #1
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338

    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!
    Evolve Designs Interactive Media
    the natural selection

  2. #2
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    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
    Evolve Designs Interactive Media
    the natural selection

  3. #3
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    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.

  4. #4
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    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.
    Evolve Designs Interactive Media
    the natural selection

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center