我正在开发一款手机游戏,并希望通过在开始屏幕上的横幅广告使其免费。我打算使用 Smaato,但根据他们的 api,他们似乎要求我在查询字符串中向他们传递 UDID 和设备 ip。Actionscript 3 有没有办法做到这一点?我正在使用的代码如下,但它只拉入一个广告,当点击该广告时,它指向 Smaato 服务器上的 2x2 gif。我从一本名为“iOS Development with Flash”的书中得到了这段代码,而且它只有几个月的历史。Smaato 的“支持”家伙帮不上什么忙。我在努力完成不可能的事情吗?
有没有人完成了对 AS3 的 Smaato 讨好?
/* 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.*::action.@target.toString();
l.addEventListener(MouseEvent.CLICK, onAdClick);
}
function onAdClick(e:MouseEvent):void
{
var request:URLRequest = new URLRequest(clickurl);
navigateToURL(request);
}
}
谢谢你的尽心帮助。
富有的