Hi Tushar! Thanks for the answer. But i'm still getting problems. Do I need to use ExternalInterface.addCallback("sendToFlash",null,sendToFlash); at flash ?
May u send a .fla example ? Tks, --Robson 2008/9/20 Tushar Vaghela <[EMAIL PROTECTED]> > Hi, > Here is the way to Pass value to Flash File. > > When you are Embedding the Flash Object in Page, Add name of the variable > and the value in parameter Movie and Embed Tag. > > Suppose your SWF file is myGame.swf, and you want to pass the UseName in > it. > > The code for this would be something like this. > > <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" > codebase=" > http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0 > " > width="765" > height="500" > id="danceMELAApp_Sep_10_Test" > align="middle" > > > <param name="allowScriptAccess" value="sameDomain" /> > <param name="movie" value="myGame.swf?UseName='myUserName'" /> > <param name="quality" value="high" /> > <param name="bgcolor" value="#ffffff" /> > <embed src="myGame.swf?UseName='myUserName'" > quality="high" > bgcolor="#ffffff" > width="765" > height="500" > name="myGame" > align="middle" > allowScriptAccess="sameDomain" > type="application/x-shockwave-flash" > pluginspage="http://www.macromedia.com/go/getflashplayer" /> > </object> > > You can Access _root.UseName in ActionScript which will return value > myUserName > > > And if you want to pass value on Runtime, Flash External Interface is handy > to do this. > > Here's how you can send value from Flash to JavaScript Function, > > Suppose you want to pass Score to submitScore function in JavaScript. > > Code in Flash > ================= > import flash.external.*; > > flash.external.ExternalInterface.call("submitScore", _root.nScore); > > > In JavaScript > ================= > function submitScore(score) > alert("Submit Score Called with ("+score+")"); > } > > > And Finally if you want to send the Value from JavaScript to Flash in > Runtime, use this. > > Suppose you want to Pass your Username to Flash from JavaScript > > In JavaScript > ================= > function thisMovie(movieName) { > var isIE = navigator.appName.indexOf("Microsoft") != -1; > return (isIE) ? window[movieName] : document[movieName]; > } > > thisMovie("myGame").sendToFlash(Username); > > Code in Flash > ================= > import flash.external.*; > > function sendToFlash(Username) { > trace("sendToFlash called with (+arguments+)"); > } > > > Application in which I have used this is > > http://sandbox.orkut.com/Application.aspx?appId=998727593002<http://sandbox.orkut.com/Application.aspx?appId=998727593002> > > > Some tips on how to use Flash with openSocial is at > http://tusharvaghela.wordpress.com/2008/06/26/using-flash-with-open-social/ > > Thank you, > Tushar > > > > > > > On Sat, Sep 20, 2008 at 7:34 AM, Robson <[EMAIL PROTECTED]> wrote: > >> >> Hi all! >> >> Again, found a solution. >> >> After looking at BuddyPoke code I saw that flash's plugin needed to >> run is v.9. >> >> Newest versions of Flash allow integration with javascript using >> External Interface. >> >> So, that's a clean solution to integrate Javascript and Flash. Another >> tip is SWFOBJECT that encapsulates lot of crossbrowser function to run >> flash using javascript. >> >> Reference: >> http://blog.deconcept.com/2005/08/16/external-interface/ >> >> Cheers, >> >> --Robson >> >> >> On 19 set, 22:29, Robson <[EMAIL PROTECTED]> wrote: >> > Hi Guys, >> > >> > After reading lots of pages about Flash and Javascript integration, I >> > found 2 ways to do that using FlashVars and SetVariable. >> > >> > 1) Under opensocial, I cant use SetVariable. I've tried to load flash >> > file using SWFOBJECT and gadgets.io.getProxyUrl, but it didnt work. >> > Does someone make it work ? Is that a security problem ? >> > >> > Error is: >> > Error calling method on NPObject! >> > >> > 2) Using FlashVars I could setup the communication, but there's a >> > weird thing happening. If I need to hide the flash object setting the >> > display to none and then make it visible again, the .swf reloads. It >> > just happens under FF and Chrome. >> > >> > Any ideas ? >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "OpenSocial Application Development" group. To post to this group, send email to opensocial-api@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-api?hl=en -~----------~----~----~----~------~----~------~--~---