0 Replies Latest reply on Sep 8, 2006 3:12 AM by RasmusFyens

    ExternalInterface handles empty strings incorrectly

      I have not been able to pinpoint the exact location of this bug, but it is fully reproducible.

      The bug occurs with ExternalInterface, when calling a Flash-function from JavaScript in the browser.

      In Flash, create a function that displays it's input-value in a textbox:

      function test(value) {
      some_textbox = 'received test-value ' + value + ' (type ' + (typeof value) + ')';

      then register the function:

      ExternalInterface.addCallback("test", null, test);

      Then call the function from JavaScript, passing a blank string as the parameter:


      now you would expect to see something like "received test-value: (type String)" on your screen.

      but instead you will see something like "received test-value: null (type String)".

      somehow, in ExternalInterface, the empty string parameter is transformed into a "null" value, which in turn is transformed back into a string-value containing the text "null".

      My workaround so far is not pretty - I detect empty strings in my JavaScript, replace them with something like "__EMPTY_STRING__", and then detect this string in my movie, and replace it back with an actual empty string.

      My guess is, the bug is in the JavaScript that ExternalInterface injects into Internet Explorer - most likely, it does a .toString() on a null-value or something, as it's composing the XML command string for the Flash player.

      (I've submitted this as a bugreport as well)