YouTubeクロムレスプレイヤーのテスト
/**
* Copyright pekeq ( http://wonderfl.net/user/pekeq )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/qICl
*/
package {
import flash.display.Sprite;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.system.Security;
import flash.display.StageScaleMode;
[SWF(width="320", height="240", backgroundColor="#802020")]
public class FlashTest extends Sprite {
private var player:Object = new Object();
private var loader:Loader = new Loader();
public function FlashTest() {
// write as3 code here..
Security.allowDomain("www.youtube.com");
stage.scaleMode = StageScaleMode.NO_SCALE;
loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);
loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));
}
private function onLoaderInit(event:Event):void {
addChild(loader);
loader.content.addEventListener("onReady", onPlayerReady);
}
private function onPlayerReady(event:Event):void {
player = loader.content;
player.setSize(320,240);
player.loadVideoById("XbbHBvy6GoU", 0, "small");
}
}
}