[ https://issues.apache.org/jira/browse/FLEX-14394?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Justin Mclean resolved FLEX-14394. ---------------------------------- Resolution: Not A Problem sample code contained infinite loop > Error: Error #1023: Stack overflow occurs on dispatchEvent > ---------------------------------------------------------- > > Key: FLEX-14394 > URL: https://issues.apache.org/jira/browse/FLEX-14394 > Project: Apache Flex > Issue Type: Bug > Components: Events > Affects Versions: Adobe Flex SDK 3.0 (Release) > Environment: Affected OS(s): Windows > Affected OS(s): Windows XP > Browser: Firefox 2.x > Language Found: English > Reporter: Adobe JIRA > > My real problem application uses 7 components in the view stack and if > you need it, I can make it downloadable from my server. It is about 50 meg, > but some of that is video. I am attempting to design an OO style approach to > shutting off a video player when the View Stack is switched away from the > View that has the player component. I can do this in another design pattern > that is tightly coupled, but I want the behavior to be transfered via event > bubbling. My component will listen for the IndexChangedEvent.CHANGE, test > it and start or stop the video. > The issue is that when I select to change the View Stack, it goes into an > endless loop from the handler method until it blows with a stack trace. > Compile and run the example code below... > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" > initialize="regEvents(event);"> > <mx:Script> > <![CDATA[ > import mx.events.IndexChangedEvent; > private function regEvents(event:Event):void { > > appViews.addEventListener(IndexChangedEvent.CHANGE, viewChanged); > } > > private function viewChanged(e:IndexChangedEvent):void { > var result:Boolean = appViews.dispatchEvent(new > IndexChangedEvent(IndexChangedEvent.CHANGE,true,false,appViews,e.oldIndex,e.newIndex,e)); > > } > ]] > > > </mx:Script> > <!-- Objects for Control Bar --> > <mx:ViewStack id="appViews" creationPolicy="all" x="10" y="119" > width="99%" height="98%" childIndexChange="this.dispatchEvent(event); " > > <mx:Panel id="homeView" label="Home" showEffect="WipeDown" > hideEffect="WipeUp" width="100%" height="100%"/> > <mx:Panel id="webView" label="Got Web 2.0?" showEffect="WipeDown" > hideEffect="WipeUp" width="100%" height="100%"/> > <mx:Panel id="processView" label="Communicaton & the Web" > showEffect="WipeDown" hideEffect="WipeUp" width="100%" height="100%"/> > </mx:ViewStack> > > <mx:ApplicationControlBar x="3" y="62" width="100%" > > <mx:ToggleButtonBar > dataProvider="{appViews}"/> > </mx:ApplicationControlBar> > </mx:Application> > Actual Results: > It seems to blow acording to the number of buttons on the Control Bar (or > objects in the viewStack) > 1st Stack Trace after selecting 2nd button > Error: Error #1023: Stack overflow occurred. > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > Close the stack window... New window opens immediately > 2nd Stack Trace after selecting 2nd button > Error: Error #1023: Stack overflow occurred. > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > > Close the stack window... New window opens immediately > 3rd Stack Trace after selecting 2nd button > Error: Error #1023: Stack overflow occurred. > at > mx.controls::Button/http://www.adobe.com/2006/flex/mx/internal::setSelected()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\Button.as:1202] > at mx.controls::Button/set > selected()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\Button.as:1180] > at > mx.controls::ToggleButtonBar/hiliteSelectedNavItem()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\ToggleButtonBar.as:426] > at > mx.controls::NavBar/changeHandler()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\NavBar.as:1128] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > at flash.events::EventDispatcher/dispatchEventFunction() > at flash.events::EventDispatcher/dispatchEvent() > at > mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051] > at > TestApp/viewChanged()[C:\EclipseProjects\Procontent\test\TestApp.mxml:12] > Expected Results: Nothing should occur at this point. If I were listening > for the event I should be able to catch it and act appropriately. > > > Workaround (if any): Another style of design, but this should work! > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira