Version 0.2 of the SWFHttpRequest Flash/Ajax Utility has been released and is available for download. This tiny Flash 9 application provides a JavaScript bridge for utilizing Flash to make cross-domain requests.
This version adds a bunch of new features and fixes over the original release announced earlier in Cross-domain Ajax via Flash:
For binary and source downloads and installation instructions, see the project homepage.
Enjoy! As always, I'll be happy to answer any questions.
Nevermind -- my version of Haxe was out of date... any idea how hard it would be to get flash 8 working? I got it to compile with a few kludges but it didn't work in IE7 on flash 8.
--Greg 18:01, 30 December 2007 (MST)
Hi Greg,
> There needs to be a call to flash.system.Security.allowDomain("mydomain.com")
Yeah, I had considered adding something to that effect. Adding an allowDomain('*') call would allow someone (like Yahoo!) to publicly host a hot-linkable version for anyone to easily use. I'll probably add this to the code and recompile the downloadable version just to make peoples' lives easer. Still thinking about it.
> ... any idea how hard it would be to get flash 8 working? I got it to compile with a few kludges but it didn't work in IE7 on flash 8.
Well, I utilized haxe's built in Http class for connectivity. Provided haxe has properly provided an ActionScript 2 compatible implementation for Flash-8 targets, it may not be too hard. But I really don't know off hand.
Right now, targeting Flash-8 isn't a high priority for me. According to Adobe's numbers, Flash 9 has 93%+ penetration across all markets as of December 2007.
Admittedly, Adobe has a marketing incentive to bias their numbers in their favor, but even if they're off by 10 or 15 percent, Flash 9 still has huge penetration, and testing for Flash version is relatively easy, especially if you use a pre-packaged toolkit like SWFObject.
> Thanks for your hard work!
No problem! This was a problem space I felt needed a fool-proof, toolkit-friendly solution.
Of course, it's important to remember that this was created in tandem with my article Cross-domain Ajax via Flash - which is only the second part in a four part series on cross-domain Ajax. So there's more to come, stay tuned ;)
--Jimbojw 21:37, 30 December 2007 (MST)
Hi Jim,
The demo works perfectly for me, but when I do my own little script I keep getting this error:
'uncaught exception: Error calling method on NPObject! [plugin exception: Error in Actionscript. Use a try/catch block to find error.].'
In the SWFHttpRequest.hx i added this,
function new(){
flash.system.Security.allowDomain("*");
flash.system.Security.allowInsecureDomain("*");
}
My use case scenario is the following:
I create a widget on a someone else domain(like a blog), then that widget makes request to my website for data.
I have setup crossdomain.xml to allow anything at this point just to make sure that is not the problem.
Any help will be much appreciated and thank you for an awesome hack.
--Casper 05:27, 20 March 2008 (MST)
Hi Jim,
I'm facing the same problem as Casper does ("uncaught exception: Error calling method on NPObject").
Can you please point us a way out?
Many thanks in advance, Mario
Mario.Pilz at gmail.com
--Mario 06:39, 28 May 2008 (MST)
I tried using the swfhttprequest() method in prototype (1.6) to be used instead but I keep getting a failed attempt even with the crossdomain.xml in place. I've had to use the same method as in the demo isntead.
--lambert 17:06, 13 July 2008 (MST)
I liked jimbojw.com a lot. It has lots of useful info. This article is very professionally written. jimbojw.com I will be back for sure.
--payday loans 12:02, 27 August 2009 (MST)
thanks! :)
lets write them until the admit it, or stop doing it! i am writing them now!
--WahMebyWhibra 15:51, 14 May 2010 (MST)
Got something to say?
or, read what others have said...
Hey Jim, I'm trying to add some functionality to your SWFHttpRequest, namely, making it so I can script it across domains. (There needs to be a call to flash.system.Security.allowDomain("mydomain.com")). However, it seems that when I compile the current version from your website it does not work in IE7. Are there changes you have made in the source that have yet to be posted? The binary version posted works perfectly in all browsers.
Thanks for your hard work!
--Greg 17:47, 30 December 2007 (MST)