I have my swf being loaded using swfobject. From within AS3 I make a call which calls FB.ui to show the pay window. To this point everything works fine. Once the payment is complete, FB.ui calls the callback which is supposed to call back to AS3. I get a reference to the swf object but the actual method call fails with Object doesn't support property or method.
I've been reading every post about this but can't find anything to help. It seems to me that getElementById isn't returning the correct object.
This only happens in IE. Chrome and FireFox work fine.
var attributes = {};
attributes.id = "game";
attributes.name = "game";
attributes.align = "middle";
swfobject.embedSWF(
"game.swf", "flashContent",
"800", "600",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
// JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
.....
FB.ui(obj, function(data) {
if(!data) {
alert("There was an error processing your payment. Please try again!");
return;
}
// alert('called back order');
// IMPORTANT: You should pass the data object back to your server to validate
// the contents, before fulfilling the order.
var gameVar = document.getElementById("game");
//alert(gameVar);
//console.log(Object.prototype.toString.call(gameVar));
//alert(gameVar.purchaseCallback);
gameVar.purchaseCallback(data);
//console.log("Payment verification complete");
});
//handle errors here
//alert('some error');
return false;
}
What makes this weirder is if I add the following to the page, clicking the link works. function test() { var game = document.getElementById("game"); alert(game.purchaseCallback); } test