1 Reply Latest reply on May 13, 2008 5:33 AM by slaingod

    Type Error with ExternalInterface.call();

      Hi...
      I am calling javascript function of wrapper from flex. The funcation is called but when it return a value , the value is not returned to flex.
      The same value if i print using alert in javascript its value is printed.

      my javascript code is like this...

      function readCookie() {
      var nameEQ = "user=";
      if(document.cookie!=""){
      var ca = document.cookie.split(';');
      for(var i=0;i < ca.length;i++) {
      var c = ca ;
      var decript_data="";

      while (c.charAt(0)==' ') c = c.substring(1,c.length);
      if (c.indexOf(nameEQ) == 0) {
      var temp = c.substring(nameEQ.length,c.length);
      alert("temp="+temp);
      decript_data=des("validation",temp,0,1,"name",0);
      alert("user="+ decript_data); // it prints value of decript_data
      return decript_data;
      }
      }
      }
      return null;
      }


      i am calling this function from flex as;

      private function userSession():void{
      var usrData:String;
      usrData=ExternalInterface.call("readCookie");
      }


      when i run the application , i am getting this error:
      TypeError: Error #1085: The element type "string" must be terminated by the matching end-tag "</string>".
      at flash.external::ExternalInterface$/call()
      at builds/userSession()
      at builds/LoadFilterVal()
      at builds/___Application1_creationComplete()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.core::UIComponent/dispatchEvent()
      at mx.core::UIComponent/set initialized()
      at mx.managers::LayoutManager/doPhasedInstantiation()
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.core::UIComponent/callLaterDispatcher2()
      at mx.core::UIComponent/callLaterDispatcher()


      ..returning a simple string from javascript is returned well to flex , but wen a variable containing string is returned the above error occurs..

      Please any one can help me to solve this problem.