4 Replies Latest reply: Mar 28, 2014 7:55 AM by Vitali Kniazeu RSS

    JavaScript Callback issue

    AlbertoC. Community Member

      Hello,

       

      I am working on a project in which I need some JavaScript to be executed from the SMP player. It loads the configuration file from an xml, and other parameters from the flashvars.

       

      I noticed that javascriptCallbackFunction is never linked when this xml flashvars.configuration is present.

      I searched for the code that creates the bridge, and found it in StrobeMediaPlayback.as:211

       

      if (configuration.javascriptCallbackFunction != "" && ExternalInterface.available && mediaPlayerJSBridge == null)
      {
           mediaPlayerJSBridge = new JavaScriptBridge(this, player, StrobeMediaPlayer, configuration.javascriptCallbackFunction); 
      }
      

       

      It is placed at the end of the initialize(...) function.

       

      This way, if the config is only flashvars parameters there is no problem, as they are already been parsed synchronously by the configurationLoader.

      However, if the config is loaded from an xml, this code will always be executed before the XMLFileLoader's Event.COMPLETE callback is fired, thus finding an empty configuration.javascriptCallbackFunction and skipping the bridge creation.

       

      Is it placed there on purpose and I am doing something wrong, or is it actually a bug?

       

      I tried moving it to initializeView() and recompiled the code with this change, and it works.

       

       

      Thank you very much!

      Alberto