+ Start a Discussion
gtuerkgtuerk 

Using Static Resource in embedded SWF

I've got to course-correct on an implementation I'm looking to build.  I've got an embedded SWF in our SF instance that uses the Google Maps API for Flex and is a positive feedback loop into Location data that's stored in SF.  It works really well and is pretty quick.  The Product Management team is excited about adding Google Earth KML overlays to this map.  The Google Maps API for Flex doesn't have great support for parsing KML but they're getting there slowly.  I've looked at a couple of different interfaces for the KML/KMZ file and Google Earth sharing.   One approach I took that is not working so well is to load the KML at time of loading of the SWF.  I've hosted the KML out on Box.net.  I'm a paying Box.net customer so the download begins immediately when attempting to load the file using the URLLoader class.  The download takes a long time, though, and is causing URLLoader to time out (the default setting is 15 seconds and even at home with High-speed internet connection this is taking longer than 15 seconds).

 

Is there a way to access Salesforce static resources in a Flex swf?  I would guess that I would still use URLLoader but maybe use the $ syntax for Static Resources?  By doing this I could offload the burden of downloading the file from a public internet location and presumably speed things up.  It doesn't make sense for me to incur a hit downloading the file each time a location is accessed.

 

I spent some time on the webinar last week trying to understand what new features would be available in Summer '09.  One that piqued my interest was Batch Apex.  Ideally, I'd like to blend with the feature above and update the static resource with realtime data on a scheduled (or ad hoc if necessary) basis

arunkarunk

Hi, 

 

Did you find a solution to this? I am looking for something similar ....

 

 

 

-Arun

kminevkminev
I also need to impement the same idea.....anyone who did it?
bbradybbrady
Also interested in the same capability.
jonesjones

I'm also interested in doing this. But i didn't find a real sollution.

I tried loading the static resources doing this from main.swf:

loader.load(new URLRequest("{!$Resource.myAnimation}"));

and

loader.load(new URLRequest("myAnimation"));

(where myAnimation.swf and main.swf are both static resources). But none of them worked. 

 

I found a workaround: placing the full url of the static resource instead of the $ syntax.

loader.load(new URLRequest("https://na1.salesforce.com/resources/127851435634/myAnimation"));

However, hardcoding the url (or even using a relative path) is not a long-term solution,since the subdomain or the timestamp can change randomly and my app will just stop working.


I'd appretiate if someone can post a definitive sollution for this problem.

Thanks.

Message Edited by jones on 10-14-2009 11:22 AM
arunkarunk

Hi,

 

 

You dont need to use full URL.

If the resource name is MyResource u can use it in relatinve link as /resources/MyRsource

The SWF is embeded in the visualforce page, and the page has the cookie values needed for authentication. So you dont need to worry about that.

 

 

Regards,

Arun