javascript to kse communication

No replies
Joined: 05/06/2009
Points: 29

Hi all

I'm calling some functions within my custom kse from javascript contained on my site.

This works fine when using my locally stored flex project, using the ExternalInterface method.

However when i load the swf via the server call which uses the FlexWrapper swf to in turn load the simpleeditor swf, the communication is breaking down. I presume this is because javascript doesn't have a direct link to the simpleeditor.swf in the DOM.

The embed code is:

<div id="kse"></div>
     </div>
     <script type="text/javascript">
     var params = {
     allowscriptaccess: "always",
     allownetworking: "all",
     wmode: "opaque",
     id:"simpleeditor",
     name:"simpleeditor"
     };var flashVars ={
          "host":"www.kalturaserver.com/kalturaCE",
          "partner_id":"1",
          "subp_id":"100",
          "UID":"{uid}",
          "ks":"{ks}",
          "kshowId":"-1",
          "entryId":"x09a75hyi8",
          "backF":"onSimpleEditorBackClick",
          "saveF":"onSimpleEditorSaveClick"};
swfobject.embedSWF("http://www.kalturaserver.com/kalturaCE/kse/ui_conf_id/666", "kse", "890", "520", "9.0.0", false, flashVars, params);
     </script>            

javascript

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
         return window[movieName];
    } else {
       
        return document[movieName];
    }
}

function changeState(value) {
       
    thisMovie("simpleeditor").appState(value);
}

actionscript

ExternalInterface.addCallback("appState", changeAppState);//within init() function

protected function changeAppState(appState:String):void{
                                var state:int = new int(appState);
                                _model.applicationState = state;
}