0 Replies Latest reply on Dec 27, 2006 4:58 AM by navedansari

    Focus Problem

    navedansari
      Hi,
      We are facing focus problem in flash messenger.We have used javascript to set focus in flash chat window.

      for example if we type message in one chat window and during that time another window is open,then focus is set for that new opened window and it start typing in another window.It means we have lost focus from previous window in which we were typing.
      we have one html file chatframe.html in which we have wrote javascript code for focus
      here is the javascript code :


      //****************************************************

      function setFocus()
      {
      var temp= false;
      window.focus();

      temp=focusagain();
      return temp;
      }
      function focusagain()
      {
      if (window.focus)
      {
      //name of flash movie mve
      mve.focus()
      return false;
      }
      else
      {
      alert("flash movie in focus");
      return true;
      }

      }

      //**************************************************************


      and it calls chatframe.swf

      here is our code for that :



      function messagereceive(){
      var temp1:Boolean= Boolean(ExternalInterface.call("setFocus"));
      if(temp1)
      {
      _root.trace1.text="if part";
      }
      else
      {
      Selection.setFocus(_root.typingArea);
      this._lockroot=true;
      var cursorpos = Selection.getCaretIndex();
      Selection.setSelection(cursorpos,cursorpos);
      }

      }

      and we have another solution but in that case we can set focus in a particular chat window but if another window is open and
      if we receive message then window does not blink
      here is that javascript code :

      function setFocus()
      {
      var temp= false;
      mve.focus()
      return false;
      }


      but we want both option setfocus and blinking window. Please if any one can help us in this matter ... Its Urgent!!!!