vv
var ytplayer:MovieClip = _root.createEmptyMovieClip("ytplayer", 1);
var ytPlayerLoaderListener:Object = new Object();
ytPlayerLoaderListener.onLoadInit = function( Void ):Void {
this.loadInterval = setInterval(checkPlayerLoaded, 250);
}
function checkPlayerLoaded( Void ):Void {
if (ytplayer.isPlayerLoaded()) {
ytplayer.addEventListener("onStateChange", onPlayerStateChange);
ytplayer.addEventListener("onError", onPlayerError);
clearInterval(this.loadInterval);
}
}
function onPlayerStateChange(newState:Number):Void {
trace("New player state: "+ newState);
}
function onPlayerError(errorCode:Number):Void {
trace("An error occurred: "+ errorCode);
}
var ytPlayerLoader:MovieClipLoader = new MovieClipLoader();
ytPlayerLoader.addListener( ytPlayerLoaderListener );
// load the player
ytPlayerLoader.loadClip("http://www.youtube.com/v/zM4P4VC1Y4w&hl=es_ES&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999", ytplayer);
ytplayer._x =300;
ytplayer._y = 60;
ytplayer._xscale=85;
ytplayer._yscale=85;