Domanda

Sto usando il seguente codice per visualizzare una pubblicità in un gioco mobile a cui sto lavorando. Funziona bene ma non so cosa mettere nella funzione ClickStart per rimuovere la pubblicità dal palco prima che il gioco giochi. Ho giocato con RemoveChild ma non riesco a farlo funzionare.

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);
    }

  }
}

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top