2 Replies Latest reply on Aug 9, 2011 12:05 AM by Vikash.kumar29

    Stumpped Out with Event sequence. Please help !!!

    Vikash.kumar29 Level 3
      Hello experts,
      I am using flex sdk 4.1 and currently completly stumpped out with event behaviour while using TabBar. Any help will be appreciable.
      Here is the complete scenario:
      When I normally click on any button having focus on dateField after clearing the selected date, then the event call sequence is :
      where change of datefield is dispatched before button click due to focusout, which is correct.
      But actual problem comes when you click on the other tab button from the TabBar, then the event sequence is :
      where change of datefield is dispatched after the tab change.
      In my actual applicatio, I am making my model dirty and on changing event I am preventing tab change, if my model is dirty.
      But due to the event sequence said above my model becomes dirty after tab change and leads to some unsaved data though my tab has been changed.
      Below is the sample code I have used for replicating said Issue:
      <?xml version="1.0" encoding="utf-8"?>
      library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
      private function log(event:Event):void
      txtArea.text = txtArea.text +
      "\n" + event.currentTarget +':' + event.type;
      <s:VerticalLayout />
      <s:TabBar dataProvider="{vs}" changing="log(event)" change="log(event)"/>
      <mx:ViewStack id="vs" width="100%" height="50%">
      <s:NavigatorContent width="100%" height="100%" label="Tab 1">
      <mx:Canvas width="100%" height="100%">
      <s:Button label="Test" click="log(event)" x="10" y="20"/>
      <mx:DateField change="log(event)" editable="true" x="10" y="49"/>
      <s:NavigatorContent width="100%" height="100%" label="Tab 2">
      <mx:Canvas width="100%" height="100%"/>
      <s:TextArea id="txtArea" width="100%" height="50%" />
      Any help will be appreciable. Please help !!!
      Vikash kumar