Type Error with ExternalInterface.call();

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default 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[i];
    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.

    v-Jay Guest

  2. Similar Questions and Discussions

    1. Problem with ExternalInterface.call and InternetExplorer
      Hi, I´m developing a site, (http://www.gen-studio.com/avelart2/), and I´m using a swf to display a set of thumbs that when clicked show an item and...
    2. Return value from ExternalInterface.call method
      Hi people, I can not achieve to get any return value from javascript other than null. In th HTML container I have a functions like this: ...
    3. ExternalInterface.call performance question
      Hi, I'm using Flash 8, using XML.Load to get some data from another site and returning it to the browser world thru a callback using...
    4. Error: Webcontrol must have items of type X. SubLinks is of type Y
      Hi, I have made a web control that has two sorts of items. The first is the Links property that has a persistence attribute of InnerProperty, the...
    5. Cast from type 'DBNull' to type 'String' is not valid error
      Trying to add an insert button Sub btnAddRow_Click event for adding a row to the datagrid and dataset back to SQL. Had it working per the...
  3. #2

    Default Re: Type Error with ExternalInterface.call();

    It may be that you are returning something to Flex that isn't being converted
    to Object nicely, like something xml-ish. What does your alert show? You
    might want to try escaping the string with > < or something to see if the error
    stops, then go from there.

    slaingod Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139