[jQuery] USING FLASH + ACTIONSCRIPT CALLBACK FUNCTION.

[jQuery] USING FLASH + ACTIONSCRIPT CALLBACK FUNCTION.


Hi,
The problem i faced when i use iframes to post data is that i can not
send information to parent frame (like a json response) if the url of
the iframe is different.
You can use Flash + actionscript to POST DATA crossdomain.
You only need a crossdomain file policy in your server web root.
An example:
http://blog.monstuff.com/Flash4AJAX/static/Xdomain.html
if have something like this
var Panel = {
_posts : [],
Save : function(data, functionCallBack){
var index = this._posts.length;
this._posts[index] = {
"onFinish" : function(strJson){
if(functionCallBack)functionCallBack(json);
}
};
var url = "http://www.yourdomain.com";
var vars = "accion=" + encodeURIComponent(data.accion);
vars = "&Name=" + encodeURIComponent(data.name);
vars = "&Company=" + encodeURIComponent(data.company);
var fs = FlashHelper.getFlash();
// URL, CALLBACK FUNCTION, METHOD,......
fs.XmlHttp(url, "Panel._posts["+index+"].onFinish", "POST",
vars, "application/x-www-form-urlencoded");
}
}
so you only need to use
Panel.Save({"Name":"Jarquin","Company":"Fujarsys"},function(strJson){
alert(json);
});