256 levels of recursion??

Ask a Question related to Macromedia Flash Actionscript, Design and Development.

  1. #1

    Default 256 levels of recursion??

    I've just started trying to write some games in flash. It seemed the ideal
    language since it's cross platform, ubiquitous and highly functional.

    However, after banging my head against problems for the last day and a half
    I'm starting to get frustrated with the language. There are all these annoying
    limitations. The two that have given me the biggest problems so far are the
    inability to trap and use right click events (without that damn menu appearing)
    and just now I've run over something that seems even more implausable - the 256
    levels of recursion limit.

    Now I fully understand *why* Macromedia put this limit in, it's to protect
    programmers from their own mistakes, but (a) 256 levels is FAR too few and (b)
    it should be something that competent programmers can turn off.

    PLEASE start treating flash like a professional language if you want
    professional programmers to start using it for real applications. If you
    continue to restrict the language's capabilities in this way Flash will forever
    remain a pretty looking toy.

    John

    floyduk Guest

  2. Similar Questions and Discussions

    1. Is Recursion Allowed?
      Is recursion allowed in cfc's?? I am getting a JRun error: 500Null when I try it. I've never tried recursion before in cold fussion so I don't...
    2. Help: "256 levels of recursion were exceeded in one action list."
      I'm trying to make this very simple mathematical flash-program that factorizes a number. So far i have succeded, but flash dosent allow the program...
    3. Size of dir (with recursion)
      Hey list. I'm having a problem reading the size of a directory with recursive directories. The problem is that du -s shows a different bytecount...
    4. Recursion
      Hi, I've never liked "recursion" but of course there are times where it is needed. I have a simple task that I am trying to do. Basically, I...
    5. Syntax for end recursion
      Hi, does ruby have a syntax or some way to tell it to use end recursion. I tried to write a recoursive factorial function (to test BigNum). However...
  3. #2

    Default Re: 256 levels of recursion??

    "floyduk" <webforumsuser@macromedia.com> wrote
    > and just now I've run over something that seems even more implausable -
    > the 256 levels of recursion limit.
    >
    > Now I fully understand *why* Macromedia put this limit in, it's to
    > protect programmers from their own mistakes, but (a) 256 levels is
    > FAR too few and (b) it should be something that competent
    > programmers can turn off.
    Anything involving that many levels of recursion will be much faster and use
    much less memory if done non-recursively.




    Ivan Peters Guest

  4. #3

    Default Re: 256 levels of recursion??

    > Anything involving that many levels of recursion will be much faster and
    use
    > much less memory if done non-recursively.
    Can you give us an example of converting a recursive function into a non
    recursive function?


    Mark Redman Guest

  5. #4

    Default Re: 256 levels of recursion??

    > Anything involving that many levels of recursion will be much faster and use
    > much less memory if done non-recursively.
    Using less memory perhaps but not faster. Entertaining as it is for you to
    presume about what I'm trying to achieve there are times when recursion is a
    valuable tool.

    John

    floyduk Guest

  6. #5

    Default Re: 256 levels of recursion??

    "Mark Redman" <co.uk> wrote 

    Walking a tree depth first.

    Recursive:

    function walkNode(currentNode:Object) {
    trace(currentNode.name);
    for (i:Number = 0; i < currentNode.numChildren; i++) {
    walkNode(currentNode.children[i]);
    }
    }


    Non-recursive:

    function walkTree(theTree:Object) {
    var nodeStack:Array = new Array;
    var indexStack:Array = new Array;

    trace(theTree.name);
    var currentNode:Object = theTree;
    var currentIndex:Number = 0;
    var done:Boolean = false;

    while (!done) {
    trace(currentNode.children[currentIndex].name);
    if (currentNode.children[currentIndex].numChildren > 0) {
    nodeStack.push(currentNode);
    indexStack.push(currentIndex);
    currentNode = currentNode.children[currentIndex];
    currentIndex = 0;
    } else {
    currentIndex++;
    while (currentIndex >= currentNode.numChildren) {
    if (nodeStack.length == 0) {
    done = true;
    } else {
    currentNode = nodeStack.pop();
    currentIndex = indexStack.pop() + 1;
    }
    }
    }
    }
    }

    (The array code could be optimised for better performance but this keeps it
    readable)

    It's certainly not easy and I wouldn't bother doing it unless I had a
    specific reason (memory/performance problems or a recursion limit in the
    language). Any performance/memory improvements in the above example are
    pretty dubious, but anything involving more complex processing of each node
    may well benefit when the number of recursions gets high.


    Ivan Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139