The alert is used to print the value of the parameter "loading", which is "false" when the alert box pops up.
However this alert message should not be popped in theory, noticing that the conditional expression is contradictory with the semantics of the upper if-else statement. Remote data is correctly received and parsed, then "updateState" is called. So I don't think it's a problem with remote data. Thanks for your comments. :) --- In [email protected], Alex Harui <[EMAIL PROTECTED]> wrote: > > What does the alert say? > > Could it be that data arrives around the time you are clicking the button? > > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of caomengchun > Sent: Monday, September 15, 2008 9:48 PM > To: [email protected] > Subject: [flexcoders] problem with switching viewstack quickly > > > I recently encounter a problem with Viewstack while switching its > children quickly. the following is part of the codes. > > Function "updateState" is used to toggle the viewstack's selected > child according to the boolean parameter "loading". "loadingBar" is a > custom loading component and "viewGrid" is a DataGrid component. > > Parameter "true" is passed when a search button is clicked and a > loading bar is presented. Paramenter "false" is passed when remote > data is received and the DataGrid "viewGrid" is presented. > > Now the problem is that when I click the search button quickly and > frequently, the alert message could popup occasionally, which could > not happen theoretically. > > Anybody can help? Thanks. > > private function updateState(loading:Boolean):void > { > if( viewStack == null) > return; > if( loading ) > viewStack.selectedChild = loadingBar; > else > viewStack.selectedChild = viewGrid; > if( loading && viewStack.selectedChild == viewGrid > || !loading && viewStack.selectedChild == loadingBar) > Alert.show(loading.toString() ); > } >

