Are you seeing any errors in Firebug or another debugging utility? - Jason
On May 7, 2:45 am, Mansur <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to develop an app with an embedded flash swf, and I'm > trying to use the ExternalInterface.call function from within the swf > to access a javascript function in the xml file. The js function > should pop up an alert message and return a string to the swf, but > does neither. I don't get any error message; I just don't get either > the alert message or the string returned. Is there some kind of a > parameter that needs to be set to use ExternalInterface? I've attached > the code used below. Thanks in advance for any help! > > I apologize if this question has come up before. I searched, but > couldn't find something similar. > > xml file : > <?xml version="1.0" encoding="UTF-8"?> > <Module> > <ModulePrefs title="Basic Game Simulator Test!"> > <Require feature="opensocial-0.7"/> > <Require feature="flash" /> > <Require feature="views" /> > </ModulePrefs> > <Content type="html"> > <![CDATA[ > <script type="text/javascript"> > > var div = document.getElementById('profile_view'); > var div_status = document.getElementbyId('status_div'); > > function getOwnerData() { > var req = opensocial.newDataRequest(); > req.add(req.newFetchPersonRequest('OWNER'), 'owner'); > req.send(onLoadOwner); > } > > function onLoadOwner(data) { > var owner = data.get('owner').getData(); > > var flashvars = "userName="+owner.getDisplayName(); > var flashAppId = "OpenSocial"; > > var swfURL = "http://xxx.com/Game_Simulator.swf"; > swfURL = swfURL + "?" + flashvars; > > document.getElementById('profile_view').innerHTML = "Called > Flash correctly"; > gadgets.flash.embedFlash(swfURL, "flashcontainer", > {swf_version: 8, id: flashAppId, width: 550, height: 400, > allowScriptAccess: "always" }); > } > > //function called from the swf > function sendOrkutUpdate(win_score, loss_score) > { > document.getElementById('profile_view').innerHTML = ''+win_score; > > alert("JS function called"); > return "sendOrkutUpdate reached"; > } > > function init() { > getOwnerData(); > } > > </script> > <script> > gadgets.util.registerOnLoadHandler(init); > </script> > <div id="flashcontainer" style="text-align: center;" width="550" > height="400" allowScriptAccess: "always"></div> > <div id="profile_view"></div> > <div id="status_div"></div> > > ]]> > </Content> > </Module> > > Code in swf : > on (release) { > > import flash.external.*; > var EIcall = "default value"; > win_holder.text = ExternalInterface.available; > try > { > EIcall = ExternalInterface.call("sendOrkutUpdate", > _root.win_holder.text, _root.loss_holder.text); > > } > catch (err:Error) > { > status_holder.text = "Call to JS failed" ; > } > > status_holder.text = EIcall ; > > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Orkut Developer Forum" group. To post to this group, send email to opensocial-orkut@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/opensocial-orkut?hl=en -~----------~----~----~----~------~----~------~--~---