1 Reply Latest reply on Mar 19, 2008 5:56 AM by SujitG

    History manager in Ineternet Explorer

      I have made a small mxml application which I registered to History
      manager. It is working fine in Mozilla Firefoxbrowser, but not working in
      Internet Explorer, the version of it is 6.0 in my system. When I am
      navigating through Accordion panel I am getting browser 'Back' button enabled in
      Mozilla, but not in Internet Explorer. I am giving the piece code here
      below, some one please suggest how to make the Back / Forward button
      enabled from flex in Internet explorer.

      <?xml version="1.0"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" width="600"
      height="800" implements="mx.managers.IHistoryManagerClient"
      initialize="mx.managers.HistoryManager.register(this);">
      <mx:Script>
      <![CDATA[
      import mx.managers.HistoryManager;
      import mx.controls.Alert;
      import mx.controls.Button;
      private var selIndex:int = 0;
      private var selLabel:String = "";
      private var selBtnId:String ="";
      private var selId:String ="";
      private var fromHistory:Boolean = true;


      private function btnClick(event:Event):void{
      selId = event.currentTarget.id;
      if(fromHistory){
      HistoryManager.save();
      }
      setText(event.currentTarget.label);
      fromHistory = true;
      }


      private function setText(lbl:String):void{
      txtBox.text = lbl;
      }


      public function saveState():Object{
      return
      {selIndex:Accord.selectedIndex,selLabel:Accord.selectedChild.label,selBtnId:selId};
      }


      public function loadState(state:Object):void{
      if(state.selBtnId != "" && state.selBtnId != undefined){
      fromHistory = false;
      state.selIndex = Accord.selectedIndex;
      //Alert.show("KKK:::"+state.selBtnId);
      //Alert.show("LLL:::"+state.selIndex+":::>"+state.selLabel);
      var btn:Button = this[state.selBtnId] as Button;
      btn.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
      //setText(btn.label);
      }
      else{
      //Accord.selectedIndex = state.selIndex;
      Alert.show("LLL:::"+state.selIndex+":::>"+state.selLabel);
      }
      }
      private function compChange():void{
      //selId = "";
      //HistoryManager.save();
      }
      ]]>
      </mx:Script>
      <!-- History management is enabled by default for this Accordion. --




      <mx:Accordion id="Accord" width="100%" height="50%"
      selectedIndex="{selIndex}"
      change="compChange();">
      <mx:VBox label="History management">
      <mx:Button id="hBTn1" label="History Manage 1"
      click="btnClick(event);" />
      <mx:Button id="hBTn2" label="History Manage 2"
      click="btnClick(event);" />
      <mx:Button id="hBTn3" label="History Manage 3"
      click="btnClick(event);" />
      </mx:VBox>
      <mx:VBox label="View">
      <mx:Button id="vBTn1" label="View 1" click="btnClick(event);" /



      <mx:Button id="vBTn2" label="View 2" click="btnClick(event);" /



      <mx:Button id="vBTn3" label="View 3" click="btnClick(event);" /



      <mx:Button id="vBTn4" label="View 4" click="btnClick(event);" /



      </mx:VBox>
      <mx:VBox label="Accordion">
      <mx:Button id="CBTn1" label="Accordion 1"
      click="btnClick(event);" />
      <mx:Button id="CBTn2" label="Accordion 2"
      click="btnClick(event);" />
      <mx:Button id="CBTn3" label="Accordion 3"
      click="btnClick(event);" />
      <mx:Button id="CBTn4" label="Accordion 4"
      click="btnClick(event);" />
      </mx:VBox>
      </mx:Accordion>
      <mx:TextInput id="txtBox" />

      </mx:Application>