all groups > flash data integration > october 2007 >
You're in the

flash data integration

group:

swf not connecting to another domain using sendAndLoad



swf not connecting to another domain using sendAndLoad waaby
10/30/2007 5:08:56 AM
flash data integration: Hi there,

Hoping someone from the good community can help me. I work for this cool
mobile company that enables all sorts of SMS powered campaigns. We have
developed a small flash widget that we host that users can point to from their
websites to sign up mobile subscriptions. You can see an example here (the
white, Free text Updates widget): http://myspace.com/msgme_67463

I want to take this to the next level and allow our clients to host the swf,
and give them flexibility to design and integrate however they want. In
testing, i am running into some connection problems. The widget uses
sendAndLoad and posts the phone number to our service. It connects and works
fine when i test movie, but the standalone swf or when hosted on another server
cannot connect. Doesn't seem like a domain security issue as i have tried
System.security.allowDomain("*"); and System.security.allowInsecureDomain("*");
to no avail, but not sure what else it could be.

Here is the code on the Submit button....any help would be appreciated....

function doSubmit() {
userData = new LoadVars();
userData.area_code = area_code;
userData.prefix = prefix;
userData.suffix = suffix;
keyword_id = 15351;
response = new LoadVars();
var url_pre:String =
"http://www.msgme.com/Main.php?comp=SubscriptionWidgetBackendWeb&keyword_id=";
var url_full:String = url_pre+keyword_id;
userData.sendAndLoad(url_full, response, "POST");
response.onLoad = function(success:Boolean) {
// If Flash is able to successfully send and load the variables from the
server-side script...
if (success) {
// if the server returned the value of isValidLogin with a value of 1...
if (this.status == '0') {
gotoAndStop (2);
} else if (this.status == '202') {
ebox.gotoAndStop("show");
ebox.status_lbl.text = "This number is invalid. Please try again.";

}else if (this.status == '1747') {
ebox.gotoAndStop("show");
ebox.status_lbl.text = "This number's already subscribed.";

}else if (this.status == '1751') {
ebox.gotoAndStop("show");
ebox.status_lbl.text = "The max number of subscribers is reached.";

}else if (this.status == '201') {
ebox.gotoAndStop("show");
ebox.status_lbl.text = "There is a system error. Try again later.";
}
/* this code is only executed if for some reason the SWF is
unable to connect to the remote page defined in LoadVars.sendAndLoad */
} else {
ebox.gotoAndStop("show");
ebox.status_lbl.text = "There's a network error. Try again later.";
}
}
};
Re: swf not connecting to another domain using sendAndLoad Tony
10/30/2007 9:28:38 PM
Wouldn't you have to have a crossdomain.xml file at the domain you were
retrieving data from?


[quoted text, click to view]
AddThis Social Bookmark Button