PASZ.COM LABS

Wednesday, September 26, 2007

ActionScript Gotcha #345: Recursive Getter

Here's a great way to create an infinite loop, and crash the Flash player with a stack overflow:


public function get myVar(): MovieClip
{
return myVar;
}


Yes, that should be:


public function get myVar(): MovieClip
{
return _myVar;
}


A single missing underscore leads to disaster!

27 Comments: