AS3 - 用于 Smaato 集成的 iOS 设备 UDID 和 IP 访问?
我正在开发一款手机游戏,并希望通过在开始屏幕上显示横幅广告来使其免费。我打算使用 Smaato,但根据他们的 api,他们要求我在查询字符串中向他们传递 UDID 和设备 ip。无论如何,Actionscript 3 可以做到这一点吗?我使用的代码如下,但它只拉入广告,当点击该广告时,它会指向 Smaato 服务器上的 2x2 gif。我从一本名为“iOS Development with Flash”的书中得到了这段代码,它只有几个月的历史。 Smaato 的“支持”人员并没有多大帮助。我是否正在努力完成不可能的事情?
有人完成了 Smaato 与 AS3 的配合吗?
/* 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);
}
}
感谢您提供的任何帮助。
富有的
I'm building a mobile game and wanted to make it free with a banner ad on the start screen. I was going to use Smaato but it seems according to their api that they require that I pass them the UDID and the device ip in the query string. Is there anyway to do that with Actionscript 3? The code I'm using is below but it only pulls in an ad and when that ad is clicked on it points to a 2x2 gif on Smaato's servers. I got this code out of a book titled "iOS Development with Flash" and it's only a few months old. Smaato's "support" guy is not much help. Am I trying to accomplish the impossible?
Has anyone accomplished Smaato ingratiation with AS3?
/* 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);
}
}
Thanks for any help you can offer.
Rich
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果请求直接来自移动设备(这里就是这种情况,因为它是一个应用程序),则 devIP 不是强制性的。如果 UDID 不可用,您也可以跳过它。 adspacer.gif 问题可能会导致用户代理不匹配。我们的支持团队将就此回复您。
最好的,
迈克尔(Smaato 公司)
If the requests are coming from a mobile directly (which is the case here because it's an app) the devIP is not mandatory. Also you can skip the UDID if it's not available. The adspacer.gif issue probably results in a user agent mismatch. Out support team will get back to you regarding this.
Best,
Michael (Smaato Inc.)
adspacer.gif 问题的原因是请求 (reqAd.jsp) 和点击 (lp.jsp) 之间的用户代理不匹配。如果您还有其他问题,请使用门户内的支持票证系统。
此致
罗伯特(Smaato 公司)
The reason for the adspacer.gif issue is a user-agent mismatch between request (reqAd.jsp) and click (lp.jsp). If you have further questions please use our support ticket system within the portal.
Best regards
Robert (Smaato Inc.)