flash on 2011-5-17
♥0 |
Line 39 |
Modified 2011-05-17 11:38:10 |
MIT License
archived:2017-03-20 06:50:53
ActionScript3 source code
/**
* Copyright yama3 ( http://wonderfl.net/user/yama3 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/iTw5
*/
package {
import flash.display.Sprite;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
import flash.display.Loader;
import flash.display.DisplayObject;
import flash.events.Event;
import flash.net.URLRequest;
import flash.system.Security;
[SWF(backgroundColor="#ffffff", width="465", height="465", frameRate="30")]
public class FlashTest extends Sprite {
private var player:Object;
private var loader:Loader;
private static var youtubePath:String = "http://www.youtube.com/v/UGP_hoQpLZQ?version=3&enablejsapi=1";
private static var playerWidth:uint = 448;
public function FlashTest() {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
init();
}
private function init():void {
Security.allowDomain("www.youtube.com");
Security.allowDomain("s.ytimg.com");
loader = new Loader();
addChild(loader);
loader.x = uint((465-playerWidth)/2);
loader.y = uint((465-playerWidth/16*9-32)/2);
loader.contentLoaderInfo.addEventListener(Event.INIT, initialize, false, 0, true);
loader.load(new URLRequest(youtubePath));
}
private function initialize(evt:Event):void {
loader.content.addEventListener("onReady", ready, false, 0, true);
}
private function ready(evt:Event):void {
player = loader.content;
player.setSize(playerWidth, playerWidth/16*9+32);
}
}
}