Quando rodo no servidor do Eclipse, ele funciona sem problema.Porém,
quando executo como Flex Application, dá esse erro ao fechar a janela:

Error: Error #1023: Stack overflow occurred.
        at flash.events::EventDispatcher/dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks
\projects\framework\src\mx\core\UIComponent.as:9298]
        at br.com.cauirs.view.components::CommonTitleWindow/fecharJanela()[F:
\Projetos\SisMaconaria\src_flex\br\com\cauirs\view\components
\CommonTitleWindow.mxml:18]
        at br.com.cauirs.view.components::CommonTitleWindow/
___CommonTitleWindow_TitleWindow1_close()[F:\Projetos\SisMaconaria
\src_flex\br\com\cauirs\view\components\CommonTitleWindow.mxml:5]

Após uma pesquisa na internet achei esse link:
http://curtismorley.com/2007/08/19/flashflex-as3-error-1023-stack-overflow-occurred/

Error #1023: Stack overflow occurred
at MyClass/get id()

Description:
This will happen if the stack has so much data that it is full.
Nothing like Thanksgiving dinner to overflow my stack.  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 'Bad Code1' 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

O erro está na função de fechar janela, mas não vejo nenhuma
recursividade como é citada no link, ou algum erro semelhante.

                        public function fecharJanela():void {
                                        dispatchEvent(new 
CloseEvent(CloseEvent.CLOSE, true));
                                        PopUpManager.removePopUp(this);
                        }

O que estou fazendo errado?

On 16 fev, 14:37, RafaelViana <[email protected]> wrote:
> Conseguiu ^^
> Erro bobo meu, não sabia que os métodos que são executados no
> eventListener, necessitam receber um evento como parametro.
> Colocando no método  o parametro event:CloseEvent, funcionou.
>
> On 16 fev, 08:32, RafaelViana <[email protected]> wrote:
>
>
>
> > Não funcionou...
>
> > Não sei por que, no debugger peguei isso, ele está disparando o
> > evento, só não está conseguindo "ouvir" ele (eu acho), ou executar a
> > função
>
> > at flash.events::EventDispatcher/dispatchEventFunction()
> >         at flash.events::EventDispatcher/dispatchEvent()
> >         at 
> > mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks
> > \projects\framework\src\mx\core\UIComponent.as:9298]
> >         at br.packages...::CommonTitleWindow/fecharJanela()[F:\Projetos
> > \SisMaconaria\src_flex\br\com\view\components\CommonTitleWindow.mxml:
> > 20]
> >         at br.packages...::CommonTitleWindow/
> > ___CommonTitleWindow_TitleWindow1_close()[F:\Projetos\src_flex\br\com
> > \view\components\CommonTitleWindow.mxml:5]
>
> > A funçao está correta, então acredito que é o listener que não está
> > correto, mas fiz conforme o que voces falaram, e mesmo assim não
> > funcionou...
>
> > Não sei, se tem alguma relação por eu criar as janelas de modo
> > dinâmico?
>
> > PopUpManager.createPopUp(this, classRef, false).addEventListener
> > (CloseEvent.CLOSE, abrirMenu);
>
> > Realmente, não sei o que está errado...
>
> > On 15 fev, 19:12, Gabriela Trindade Perry <[email protected]>
> > wrote:
>
> > > Nao precisa disso nao.
> > > Mas se um dia ficares curioso, olha o fonte do Cairngorm, que e assim
> > > que ele funciona.
>
> > > Enfim: se passares um CloseEvent, da StackOverFlow. Sei la porque.
> > > Se disparas um evento qualquer, funciona blz.
>
> > > APP
> > > d = PopUpManager.createPopUp(this, Dialog, false) as Dialog;
> > > d.addEventListener("fechar", fecharMenu);
>
> > > TTW
> > > <mx:TitleWindow
> > >         xmlns:mx="http://www.adobe.com/2006/mxml";
> > >         layout="absolute" width="200" height="200"
> > >         showCloseButton="true"
> > >         close="fechar()">
>
> > >         <mx:Script>
> > >                 <![CDATA[
> > >                         import mx.managers.PopUpManager;
>
> > >                         private function fechar():void{
> > >                                 this.dispatchEvent(new Event("fechar", 
> > > true));
> > >                                 PopUpManager.removePopUp(this);
> > >                         }
> > >                 ]]>
> > >         </mx:Script>
>
> > >         <mx:Label text="JANELA"/>
> > > </mx:TitleWindow>
--~--~---------~--~----~------------~-------~--~----~
Você recebeu esta mensagem porque está inscrito na lista "flexdev"
Para enviar uma mensagem, envie um e-mail para [email protected]
Para sair da lista, envie um email em branco para 
[email protected]
Mais opções estão disponíveis em http://groups.google.com/group/flexdev
-~----------~----~----~----~------~----~------~--~---

Responder a