Flash Compiler Bug?

by Jim May 10, 2007 8:52 AM

I got the following error when running my flash program:

VerifyError: Error #1030: Stack depth is unbalanced. 2 != 0

The adobe documentation implies that the SWF file is corrupt; presumably this is due to a bug in the compiler, or a bug related to interpreting the compiled code.

I panicked for a second there - how do you work around a bug in the compiler? Wait for the next version? But I started playing with the code and found the source of the problem. Here's my function:

private function clickHandler(event:MouseEvent):void
{
    // Is the click on the region of the main "button"?
    if (SymbolMenuButton(getChildAt(0)).hitTestPoint(event.stageX, event.stageY))
    {
        showSubs(getChildAt(1).visible != true);
    }
    else if (mSymbols.visible && mSymbols.hitTestPoint(event.stageX, event.stageY))
    {
        // ToDo: Determine which symbol was clicked
        dispatchEvent(new TextEvent(SYMBOL_CLICK, true, false, 
            mGlyphs[mSymbolsIndex, 1, 1]));
    }
    event.stopPropagation();
}

 The exception was thrown in the first if block, not on the offending line, which is the dispatchEvent; specifically, the array access is causing the problem. If I change this to mGlyphs[mSymbolsIndex][1][1], then everything is fine.

It would appear that the compiler allows the incorrect array access, then the flash player gets confused by the compiled code and throws an error.

Tags:

Comments

2/7/2010 1:00:25 PM #

Carl

Late, I know, but thanks for that.  It's weird that in 2009 they still don't detect that syntax problem at compile time.

Anyway, thank you.  Saved me tearing out my hair.

Carl

2/7/2010 1:00:25 PM #

Ogom

Thanks man.
I was cracking my head trying to figure that one out

Ogom

Add comment


(Shows Gravatar icon; will not be displayed)

  Country flag
Click to change captcha
biuquote
  • Comment
  • Preview
Loading