我正在構建手機遊戲,並希望在開始屏幕上使用橫幅廣告免費。我打算使用Smaato,但似乎根據他們的api,他們要求我將UDID和設備ip傳遞給查詢字符串。無論如何用Actionscript 3來做到這一點?我使用的代碼在下面,但它只能吸引廣告,當點擊該廣告時,它指向Smaato服務器上的2x2 gif。我從一本名爲「使用Flash的iOS開發」的書中得到了這段代碼,它只有幾個月的時間。 Smaato的「支持」人沒有太大的幫助。我在努力完成不可能的事情嗎?AS3 - iOS設備用於Smaato集成的UDID和IP訪問?
有沒有人用AS3完成Smaato ingratiation?
/* SMAATO Advertising Code for Start Page
var request:URLRequest = new URLRequest("http://soma.smaato.com/oapi/reqAd.jsp");
var variables:URLVariables = new URLVariables();
variables.adspace = "65741799";
variables.pub = "923842495";
//variables.devip = "127.0.0.1"; The book had this line but it's not right so I commented it out
variables.format = "IMG";
variables.adcount = "1";
variables.response = "XML";
request.data = variables;
var loader:URLLoader = new URLLoader();
var l:Loader = new Loader();
loader.addEventListener(Event.COMPLETE, onComplete);
loader.load(request);
function onComplete(e:Event):void
{
var data:XML = new XML(loader.data as String);
var status:String = data.*::status.toString();
if(status == "success")
{
var ad:XMLList = data.*::ads.*::ad;
var link:String = ad.*::link.toString();
var l:Loader = new Loader();
l.load(new URLRequest(link));
addChild(l);
l.x = 80;
l.y = 255;
var clickurl:String = ad.*::[email protected]();
l.addEventListener(MouseEvent.CLICK, onAdClick);
}
function onAdClick(e:MouseEvent):void
{
var request:URLRequest = new URLRequest(clickurl);
navigateToURL(request);
}
}
感謝您提供任何幫助。
豐富