Help: "256 levels of recursion were exceeded in one action list."

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

  1. #1

    Default 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 loop more than 256 times is seems. I get this message:

    "256 levels of recursion were exceeded in one action list.
    This is probably an infinite loop.
    Further execution of actions has been disabled in this movie."

    Is there some way I can avoid this, or work my way around somehow?.


    ************************
    The Actionscripting is as such:

    var divident:Number = 2;
    var tallToFactor:Number;
    var tallToFactorOrig:Number;
    var toFinish:Number;
    var numbercount:Number = 0;

    function fact():Void {
    if (tallToFactorOrig == toFinish){
    return;
    }
    else {
    if (tallToFactor/divident == Math.floor (tallToFactor/divident)) {
    trace (divident);
    tallToFactor = tallToFactor/divident;
    if (numbercount == 0) {
    toFinish = divident;
    numbercount++;
    }
    else {
    toFinish *= divident;
    }
    fact();
    }
    else {
    if (divident == 2) {
    divident++;
    fact();

    }
    else {
    divident += 2;
    fact();

    }
    }}}

    mcButton.onPress = function():Void {
    divident = 2;
    tallToFactor = tNumberType.text; //tNumberType is a input textfield where
    the number to factorize is typed
    tallToFactorOrig = tNumberType.text;
    fact();
    }
    **************************


    Roald Fernandez Guest

  2. Similar Questions and Discussions

    1. cfqueryparam ignores null="yes" when list="yes"
      I get an unexpected result when using cfqueryparam with list="yes" and null="yes" using CF 7.0.1 and MSSQL 2000. When i run this code: <cfset...
    2. CFMX7's numerous "request has exceeded the allowabletime limit Tag" bomboffs
      Prior to CFMX, you could bump up the RequestTimout on the URL, example: mypage.cfm?RequestTimeout=120. Under CFMX (6.1) you could do it with cfset...
    3. Form processing: change the "action=" based on pull down menu
      Hi group - I have an html form for that uses username and password to login to a specific area of the website. The "area" the user wants to go to...
    4. Using "Levels" and "Curves" tools for alpha channel
      Well, the topic says it all. This is one of the three Photoshop flaws that made me evaluate other programs, and I haven't figured out how to do it in...
    5. "Start" "Program" "Menu" list is empty
      For what ever reason my list of installed programs in my "Start" "Programs" menu is empty. Anyone know how to restore the list. Thanks for your...
  3. #2

    Default Re: "256 levels of recursion were exceeded in one action list."

    Given the code, the acion-scripting only allows numbers that have prime
    numbers up to 503. Wich makes sence regarding the 256 times loop-limit,
    since the program tests numbers with the increment of 2.

    Id much appreciate if anyone knows some whay to get around the loop-limit.
    Im very familiar with actionscript so, please, any help would be great.


    Roald Fernandez Guest

  4. #3

    Default Re: "256 levels of recursion were exceeded in one action list."

    Typo there...
    I'm not very familiar with actionscripting
    :))


    Roald Fernandez Guest

  5. #4

    Default Re: "256 levels of recursion were exceeded in one action list."

    that's tail end recursion, so you should be able to rewrite your function as
    a loop (instead of being recursive).


    Artful Guest

  6. #5

    Default Re: Help: "256 levels of recursion were exceeded in one action list."

    ahhhhh! ... mathematics ... my favorite ...

    have you tried to write a NON-RECURSIVE version of the fact():Void
    function? a non-recursive version would most probably be using 'do'
    or 'while' or 'for' loop of some sort.

    -----
    The Count, Singapore
    Learning Objects (e-Learning) Specialist






    Roald Fernandez wrote:
    > 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 loop more than 256 times is seems. I get this message:
    >
    > "256 levels of recursion were exceeded in one action list.
    > This is probably an infinite loop.
    > Further execution of actions has been disabled in this movie."
    >
    > Is there some way I can avoid this, or work my way around somehow?.
    >
    >
    > ************************
    > The Actionscripting is as such:
    >
    > var divident:Number = 2;
    > var tallToFactor:Number;
    > var tallToFactorOrig:Number;
    > var toFinish:Number;
    > var numbercount:Number = 0;
    >
    > function fact():Void {
    > if (tallToFactorOrig == toFinish){
    > return;
    > }
    > else {
    > if (tallToFactor/divident == Math.floor (tallToFactor/divident)) {
    > trace (divident);
    > tallToFactor = tallToFactor/divident;
    > if (numbercount == 0) {
    > toFinish = divident;
    > numbercount++;
    > }
    > else {
    > toFinish *= divident;
    > }
    > fact();
    > }
    > else {
    > if (divident == 2) {
    > divident++;
    > fact();
    >
    > }
    > else {
    > divident += 2;
    > fact();
    >
    > }
    > }}}
    >
    > mcButton.onPress = function():Void {
    > divident = 2;
    > tallToFactor = tNumberType.text; //tNumberType is a input textfield where
    > the number to factorize is typed
    > tallToFactorOrig = tNumberType.text;
    > fact();
    > }
    > **************************
    >
    >
    Der Zählmeister 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