Ask a Question related to Macromedia Flash Actionscript, Design and Development.
-
floyduk #1
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
-
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... -
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... -
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... -
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... -
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... -
Ivan Peters #2
Re: 256 levels of recursion??
"floyduk" <webforumsuser@macromedia.com> wrote
Anything involving that many levels of recursion will be much faster and use> 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.
much less memory if done non-recursively.
Ivan Peters Guest
-
Mark Redman #3
Re: 256 levels of recursion??
> Anything involving that many levels of recursion will be much faster and
useCan you give us an example of converting a recursive function into a non> much less memory if done non-recursively.
recursive function?
Mark Redman Guest
-
floyduk #4
Re: 256 levels of recursion??
> Anything involving that many levels of recursion will be much faster and use
Using less memory perhaps but not faster. Entertaining as it is for you to> much less memory if done non-recursively.
presume about what I'm trying to achieve there are times when recursion is a
valuable tool.
John
floyduk Guest
-
Ivan #5
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



Reply With Quote

