Ho trovato un codice per implementare i filmati di youtube in flash e funziona bene.
Il problema è che non riesco a rimuovere il filmato alla pressione di un tasto.
Ho associato al tasto l’ azione: ytplayer.removeMovieClip();
In questo modo il player sparisce, ma la musica continua a sentirsi lo stesso!!!
C’è soluzione per terminare ogni processo?


// create a MovieClip to load the player into
var ytplayer:MovieClip = _root.youtube.createEmptyMovieClip("ytplayer", 1);
ytplayer._xscale = 50;
ytplayer._yscale = 40;
// create a listener object for the MovieClipLoader to use
var ytPlayerLoaderListener:Object = {onLoadInit:function () {
// When the player clip first loads, we start an interval to
// check for when the player is ready
loadInterval = setInterval(checkPlayerLoaded, 250);
}};
var loadInterval:Number;
function checkPlayerLoaded():Void {
// once the player is ready, we can subscribe to events, or in the case of
// the chromeless player, we could load videos
if (ytplayer.isPlayerLoaded()) {
ytplayer.addEventListener("onStateChange", onPlayerStateChange);
ytplayer.addEventListener("onError", onPlayerError);
clearInterval(loadInterval);
}
}
function onPlayerStateChange(newState:Number) {
trace("New player state: "+newState);
}
function onPlayerError(errorCode:Number) {
trace("An error occurred: "+errorCode);
}
// create a MovieClipLoader to handle the loading of the player
var ytPlayerLoader:MovieClipLoader = new MovieClipLoader();
ytPlayerLoader.addListener(ytPlayerLoaderListener) ;
// load the player
ytPlayerLoader.loadClip("http://www.youtube.com/v/05bZLLcDCQI&feature=relmfu&autoplay=1", ytplayer);