1023 Stack overflow occurred.

Description:
This will happen if the stack has so much data that it is full. What is a stack and how does it get full you ask. Simply put each method(function) has a stack and that stack stores data associated with the method such as local variables with the method. Although it is a good idea to understand what a stack is you really you don’t need to have an in depth understanding of stacks to understand this error and it’s solution. Basically this error is saying that you are most likely calling the function recursively. Or in other words you might be calling the function from within itself.

Solution:
To rid yourself of ActionScipt error 1023 make sure that you don’t call the method from within itself which will eliminate any type of recursion in your method call. You may be tempted to do this by setting a variable name the same as the function name. Change either one and this will go away. Notice in the first example that each time the getter returns what you think is an ‘int’ you actually are calling the setter function again recursively. The trace statement will also produce AS3 Error #1023

Incorrect:

public function set id (myId:int):void
 {
 this._id = id;
 }
 public function get id ():int
 {
 trace("this.id",this.id);
 return this.id;
 }

Correct:

public function get id ():int
 {
 trace("this.myId",this.myId);
 return this.myId;
 }

Incorrect:

private function recursiveLoop ():void
 {
 recursiveLoop ();
 }

Correct:

private function noRecursion():void
 {
 someOtheFunction ();
 }

Incorrect:

<s:Button icon="{button1}" id="button1" width="32" height="32"/>

Correct:

<s:Button icon="{myFxg}" id="button1" width="32" height="32"/>
Advertisements

5 thoughts on “1023 Stack overflow occurred.

  1. Hi Curtis,

    I found your site while searching around for help with error 1023. While coding it happened to me the strangest thing, and i’m quite sure this is a naughty but…
    Try to open a new AS3 FLA file, and write in the Actions Panel this simple code:

    function someFunc(x1:String, x2:String, x3:Number=0):String
    {
    var my_result:String = “result”;
    return my_result;
    }
    someFunc(”someVal1″, “someVal2″);

    Calling someFunc will call a stack overflow error!!! The only way not to have it is to remove the “x3″ Parameter. That’s sooooooo strange (and annoying, ’cause before realizing this was a bug i was getting crazy trying to find an error in my original code, which was much more complex).

    P.S. i’m using FlashPlayer debugging version 9.0.r47, i hope it’s his fault

    Kind regards & a nice day,

    Daniele

    Like

  2. Daniele,

    Is there anything else in your code labeled ‘x3′. A method perhaps? If so, this may be why you are getting this error. If not, I would love to see your file help you find out why you are getting AS3 Error 1023 it could be.

    Thanks,
    Curtis J. Morley

    Like

  3. Hi Curtis,

    I’m thankful for the help, but I tried it with no other code to be sure it was a bug, and that AS I wrote you is the stripped out version I finally reached.
    Just copy&paste the ActionScript I wrote in a new AS3 FLA (without anything else) and you should get the error… Straaaaaaaaange.

    Thanks & regards 🙂

    Daniele

    Like

  4. P.S. it suffices to add something between “my_result” declaration and the function return, not to get this error, like:

    var my_result:String = “result”;
    var someVar:String = “”;
    return my_result;

    And this makes this bug even more queer 🙂

    Like

  5. Daniele,

    I find that every time I run into a wall I copy the ActionScript into a text editor and then paste the exact same ActionScript back into Flash/Flex. This has solved the problem for me about 8 times now. I have had other friends say the same thing. If they copy and paste the ActionScript without changing anything it will often resolve the problem.

    Thanks for reading and Happy Flashing
    Curtis J Morley

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s