Question

J'utilise le code suivant pour afficher une publicité dans un jeu mobile sur lequel je travaille. Cela fonctionne bien, mais je ne sais pas quoi mettre dans la fonction Clickstart pour supprimer l'annonce de la scène avant le jeu du jeu. J'ai joué avec Removechild mais je n'arrive pas à le faire fonctionner.

stop();
startButton.addEventListener(MouseEvent.CLICK,clickStart);

function clickStart(event:MouseEvent) {
gotoAndStop("play");
}


var request:URLRequest = new URLRequest("http://soma.smaato.com/oapi/reqAd.jsp");
var variables:URLVariables = new URLVariables();
variables.adspace = "0";
variables.pub = "0";

variables.devip = "127.0.0.1";
variables.format = "IMG";
variables.adcount = "1";
variables.response = "XML";
request.data = variables;
var loader:URLLoader = new URLLoader();

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 = 135;
l.y = 265;
    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);
    }

  }
}

Pas de solution correcte

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top