dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] 256 levels of recursion

Hybrid View

  1. #1
    Member
    Join Date
    Aug 2006
    Location
    North of the South Pole
    Posts
    46

    [F8] 256 levels of recursion

    Is there any way to tell Flash to go beyond the 256 levels of recursion of a function? I may need to have up to 19,683 (3^9) levels of recursion for my function to go to its maximum extent. Is it possible to go beyond the 256 limit?

  2. #2
    Senior Member
    Join Date
    Apr 2001
    Posts
    175
    heheh, it's these little limitations that make working with flash so....interesting

    I don't know about this 256 limit, but if it's for real, here's what you do:

    -If it's tail recursion, convert it into a loop.
    -If it's not, since flash's stack won't do the trick for you, make your own: throw locals on the heap instead. Create an array, push your local variables onto it before you make a recursive subcall, then pop them off and restore them after. It's not too fast, but correct at least. And if there's certain temporary variables that maybe you won't need again after the first subcall, don't bother saving it.

  3. #3
    Member
    Join Date
    Aug 2006
    Location
    North of the South Pole
    Posts
    46
    Hmm... I never thought of converting it to a loop... Problem Solved! Thanks for the idea!

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