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

YouTube apiplayer

Get Adobe Flash player
by psyark 13 Nov 2009
/**
 * Copyright psyark ( http://wonderfl.net/user/psyark )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/rTWE
 */

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("dt-1QCFEnBE");
        }
        private function enterFrame(event:Event):void {
            loader.rotationX = mouseY * -0.5;
            loader.rotationY = mouseX * +0.5;
        }
    }
}