Adobe Flash Related Questions

5 views
Skip to first unread message

isolated

unread,
Jul 7, 2008, 2:35:53 PM7/7/08
to Orkut Developer Forum
Hello All

Q:1
Can i add a .swf file in the Application which loads data from an
external server?
I read in the documentation that all the resouces should be bundled in
the .swf file.


Q:2
In ordinary html we can set many parameters for a .swf file, like
autoplay, transparent window, even we can communite between browser
and swf file using flash vars
But i took a look at gadget programming's api reference and found
nothing about setting these paraemeters for flash
How can i add them?


Thanks in advance

davew

unread,
Jul 8, 2008, 2:03:42 AM7/8/08
to Orkut Developer Forum
A1: Yes you can add Flash to a OpenSocial application, and have it
load data or assets from an external server. You can either use the
js makeRequest (via the actionscript ExternalInterface) or you can use
a crossdomain.xml to talk directly to your server. You do not need to
bundle all resources in to your swf. You can load them as needed.
Just keep in mind things like Cache-Control on files and using
getProxyUrl to reduce the hit on your server.

A2. I've found using a combination of SWFObject + getProxyUrl works
well. You can use getProxyUrl to get a proxied url to your swf file.
Then pass the proxied url to SWFObject, along with your allowscript,
etc, flags.

isolated

unread,
Jul 8, 2008, 8:31:00 AM7/8/08
to Orkut Developer Forum
Thanks a lot for your Reply Dave
I have problem with 2nd Answer, I couldnt understand it.
Please explain this getProxyUrl in detail. Any example code or
documentation regarding it?
Thanks again

davew

unread,
Jul 8, 2008, 11:45:42 AM7/8/08
to Orkut Developer Forum
Try this:
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="TestFlash" summary="..." description="..."
icon="..." thumbnail="..." author_email="..."
author="..." screenshot="..." height="500">

<Require feature="opensocial-0.7"/>
<Require feature="flash" />
<Require feature="dynamic-height"/>
<Require feature="views" />
</ModulePrefs>

<Content type="html">
<![CDATA[
<script>document.write('<scr' + 'ipt src="' +
gadgets.io.getProxyUrl('http://...yourserver..../swfobject.js',
{ "REFRESH_INTERVAL": (60*60*24*365) }) + '"></scr' + 'ipt>'); </
script>

<div id="flashcontainer" style="height:500px"> </div>

<script type="text/javascript">
function startGadget()
{
// url to swf, followed by a version number so you can update the
file
var flashUrl = "http://yourserver.com/yourswf.swf?v=1.001";

// proxied version of swf - it will cache the swf on google's
servers for 365 days
var movie = gadgets.io.getProxyUrl(flashUrl, { "REFRESH_INTERVAL":
(60*60*24*365) });

var so = new SWFObject(movie, "myflash", "450", "500", "9",
"#ffffff");
so.addParam("wmode", "transparent");
so.addParam("allowScriptAccess", "always");
so.addVariable("var1", "value1");
so.addVariable("var2", "value2");
so.write("flashcontainer");

gadgets.window.adjustHeight();
}

gadgets.util.registerOnLoadHandler(startGadget);
</script>

]]>
</Content>
</Module>

isolated

unread,
Jul 9, 2008, 1:49:12 PM7/9/08
to Orkut Developer Forum
Millions of Thanks Dave :)

Bruno Souza

unread,
Jul 9, 2008, 5:07:02 PM7/9/08
to Orkut Developer Forum
Hi!

I can't embedded nothing in my application... just appear a blank
square...

I tried put <embed> directly,gadget.flash.embedFlash(), SWFObject +
getProxyUrl using the same example of davew and nothing...

I send here what I did:

<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="TestFlash" summary="..." description="..."
icon="..." thumbnail="..." author_email="..." author="..."
screenshot="..." height="500">
<Require feature="opensocial-0.7"/>
<Require feature="flash" />
<Require feature="dynamic-height"/>
<Require feature="views" />
</ModulePrefs>
<Content type="html">
<![CDATA[
<script>document.write('<scr' + 'ipt src="' +
gadgets.io.getProxyUrl('http://www.gadgets.cineflip.com/orkut/js/
swfobject.js',
{ "REFRESH_INTERVAL": (60) }) + '"></scr' + 'ipt>'); </script>

<div id="flashcontainer" style="height:500px"> </div>

<script type="text/javascript">
function startGadget()
{
// url to swf, followed by a version number so you can update
the file
var flashUrl = "http://www.youtube.com/v/AmqT9ERKhVY&hl=pt-
br&fs=1";

// proxied version of swf - it will cache the swf on google's
servers for 365 days
var movie = gadgets.io.getProxyUrl(flashUrl,
{ "REFRESH_INTERVAL":
(60*60*24*365) });

var so = new SWFObject(movie, "myflash", "450", "500", "9",
"#ffffff");
so.addParam("wmode", "transparent");
so.addParam("allowScriptAccess", "always");
so.addParam("allowFullScreen", "true");
so.write("flashcontainer");

gadgets.window.adjustHeight();
}

gadgets.util.registerOnLoadHandler(startGadget);
</script>]]>
</Content>
</Module>


Thanks for attention!
Bruno Souza
Reply all
Reply to author
Forward
0 new messages