Tweener and “256 levels of recursion were exceeded in one action list”

Tweeners’ great, but I came across one little problem the other day: when I tried to remove an externally loaded swf from the stage while it was mid-animation, Tweener could bring the whole Flash movie to a halt with the error ’256 levels of recursion were exceeded in one action list’.

Obviously that’s bad – because this particular error completely stops the flash player with no warning to the end user.  And the fact that external content – which I have no control over – can cause this is doubly bad.

All is not lost however, because Tweener has a useful little function: Tweener.removeAllTweens(); ok, so it can interfere with everything on your flash movie as well, but at least it’s stopping the recursion errors.

So, if you try to remove a loaded swf file with .removeMovieClip(), you might find that it’s using Tweener.  And if so, call Tweener.removeAllTweens() before you call .removeMovieClip() and you’ll be fine.  Phew! case closed.

Resources;

About James

James is a Senior New Media Developer at MMT Digital, and has BA(Hons) in Design for Interactive Media from the University of Gloucestershire. He loves designing and producing all sorts of website and Flash-related things, as well as prattling on about technologies.Day-to-day he works with Flash, Dreamweaver, Director, Microsoft Office Sharepoint Server 2007 (MOSS) and in his spare time he mucks about in Flex and Wordpress.Follow James on Twitter.

6 Responses to “Tweener and “256 levels of recursion were exceeded in one action list””

  1. lee 13th October, 2008 at 4:05 pm # Reply

    There’s also good ol’ removeTweens()

    Tweener.removeTweens(target:Object [, property1:String, property2:String, ...]):Boolean;

    http://hosted.zeh.com.br/tweener/docs/en-us/

  2. Fran 23rd October, 2008 at 9:30 am # Reply

    Thanks for this – in my case Tweener caused this error to be thrown when calling a shift to another scene. Calling this before that action fixed it. I know I would have been pulling my hair out over this for hours ; )

  3. Dave 27th January, 2009 at 9:49 pm # Reply

    Two days off hell at work, then I found this article :) thanx!

  4. dave 16th October, 2009 at 2:22 am # Reply

    This does remove a all tweens, however, if an onComplete function is called, that function is still called at the end of the amount of time any tweens would have taken! How does one deal with that, as this will cause errors in some cases!

  5. ben 10th December, 2009 at 3:57 pm # Reply

    Thank god I stumbled upon this!

    I had a similar problem to Fran where this would come up if I interrupted an animation with a button click mid flow.

    I had to call removeTween on each button but it works!

    Thanks so much James!

  6. Mcfingers 6th January, 2011 at 3:31 pm # Reply

    Great great great article !!! Thanx 4 the tip !

Leave a Reply

Note: This post is over 3 years old. You may want to check later in this blog to see if there is new information relevant to your comment.