In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: YouTubeクロムレスプレイヤーのテスト

こっちのほうがわかりやすいですね
/**
 * Copyright undo ( http://wonderfl.net/user/undo )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/i4fn
 */

// forked from pekeq's YouTubeクロムレスプレイヤーのテスト
//こっちのほうがわかりやすいですね
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(160,120);
                player.loadVideoById("lUsr1tzVpRE", 0, "small");
        }
        
    }
}