I would verify that the .state property really has changed.  Don't
forget that alert is not blocking (there is no blocking in AS3) so the
code after Alert.show runs right away.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of j_lentzz
Sent: Wednesday, April 23, 2008 12:15 PM
To: [email protected]
Subject: [flexcoders] Re: Alert Box changes State of app

 

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "j_lentzz" <[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> I have a screen that has 2 states that I move between. Neither one is
> the baseState. I have a checkbox that pops up an Alert box for
> confirmation. When the Alert pops up, the screen goes to a third
> state (maybe the baseState), instead of staying on the currentState. 
> Has anyone else seen this and know how to prevent the changing state?
> 
> Thank you,
> 
> John
>
FWIW, I tried changing the code to have a baseState and a 2nd state. 
The second state does the following:
<mx:State name="dateModeState">
<mx:RemoveChild target="{startDateLabel}"/>
<mx:RemoveChild target="{startDate}"/>
<mx:RemoveChild target="{spacer1}"/>
<mx:RemoveChild target="{numDaysLabel}"/>
<mx:RemoveChild target="{numDays}"/>
<mx:RemoveChild target="{spacer2}"/>
<mx:RemoveChild target="{endDateLabel}"/>
<mx:RemoveChild target="{endDate}"/>
<mx:RemoveChild target="{nonDmSpacer}"/>

<mx:AddChild position="firstChild" relativeTo="{dateHBox}">
<mx:Label text="Date:" id="dateModeDateLabel"
fontWeight="bold" visible="{dateMode.selected}"
width="{setDateModeWidth(dateMode.selected, 'dateModeDateLabel')}"/>
</mx:AddChild>
<mx:AddChild position="after" relativeTo="{dateModeDateLabel}">
<mx:DateField id="dateModeDate" editable="true"
focusOut="dateLosingFocusHandler(event)"
keyDown="dateCheckForEnter(event)" 
close="dateCloseHandler(event)"
visible="{dateMode.selected}"
width="{setDateModeWidth(dateMode.selected, 'dateModeDate')}"
selectableRange="{{rangeEnd: new Date()}}"/>
</mx:AddChild>
<mx:AddChild position="after" relativeTo="{dateModeDate}">
<mx:Spacer id="dmSpacer" width="418" height="10"/>
</mx:AddChild>
</mx:State>

What it looks like is happening is that when the Alert box appears,
the RemoveChild statements are executed, but not the AddChild. As a
result, the screen visually changes when the Alert box appears.

John

 

Reply via email to