0

I am using as3-signals-v0.9-BETA in a simple slide application. In my signal handler, I am dispatching the same signal again based on some conditions.

The application throws an exception after a couple of hours on the signals dispatch method. Below is a stack trace:

Error:

Error #1023: Stack overflow occurred.
     at com.chetansachdev.components::SlideDeck/onNextSlidePleaseEvent()[D:\cb-trunk\Solutions\Components\Slidelib\src\com\chetansachdev\components\SlideDeck.as:75]
     at org.osflash.signals::Slot/execute()[C:\Users\Robert\Documents\Flash\OSFlash\signals\as3-signals\src\org\osflash\signals\Slot.as:87]
     at org.osflash.signals::OnceSignal/dispatch()[C:\Users\Robert\Documents\Flash\OSFlash\signals\as3-signals\src\org\osflash\signals\OnceSignal.as:125]
     at com.chetansachdev.components::SlideDeck/onNextSlidePleaseEvent()[D:\cb-trunk\Solutions\Components\Slidelib\src\com\chetansachdev\components\SlideDeck.as:89]
     at org.osflash.signals::Slot/execute()[C:\Users\Robert\Documents\Flash\OSFlash\signals\as3-signals\src\org\osflash\signals\Slot.as:87]
     at org.osflash.signals::OnceSignal/dispatch()[C:\Users\Robert\Documents\Flash\OSFlash\signals\as3-signals\src\org\osflash\signals\OnceSignal.as:125]
     ...
     ...

Method:

mysignal.add(mySignalHandler);

function mySignalHandler():void
{
    if(condition)
    {
       // do something here..
    }
    else
    {
        mysignal.dispatch();
    }
}

Can some one point me, what is wrong. When I am dispatching from the signal handler, is the stack getting created? (I am not calling the method directly, I am dispatching a signal).

4

1 回答 1

0

这是一个无限循环。就像这样写:

function inifityAndBeyond(){
    infinityAndBeyond();
}

换句话说,在信号的处理程序中调度相同的信号是没有意义的。

于 2013-04-18T12:48:01.853 回答