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 apiplayer

Get Adobe Flash player
by kururu99 19 Aug 2011
/**
 * Copyright kururu99 ( http://wonderfl.net/user/kururu99 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/1BsY
 */

// forked from psyark's YouTube apiplayer
package {
    import flash.display.Sprite;
    import flash.display.Loader;
    import flash.events.Event;
    import flash.net.URLRequest;
    [SWF(frameRate=60)]
    public class FlashTest extends Sprite {
        private var loader:Loader;
        private var player:Object;
        public function FlashTest() {
            x = stage.stageWidth / 2;
            y = stage.stageWidth / 2;
            loader = new Loader();
            loader.z = 100;
            loader.contentLoaderInfo.addEventListener(Event.INIT, loadInit);
            loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));
            addChild(loader);
            stage.addEventListener(Event.ENTER_FRAME, enterFrame);
        }
        private function loadInit(event:Event):void {
            player = loader.content;
            player.addEventListener("onReady", playerReady);
            player.x = -stage.stageWidth / 2;
            player.y = -stage.stageWidth / 2;
        }
        private function playerReady(event:Event):void {
            player.setSize(stage.stageWidth, stage.stageHeight);
            player.cueVideoById("tvaod0bmlss");
        }
        private function enterFrame(event:Event):void {
            loader.rotationX = mouseY * -0.5;
            loader.rotationY = mouseX * +0.5;
        }
    }
}