Created
June 30, 2015 22:14
-
-
Save lucasmlessa/755c7228c0cc379869b8 to your computer and use it in GitHub Desktop.
Player do Youtube em ActionScript 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Security.allowDomain("www.youtube.com"); | |
| var videoPlayer:Object; | |
| var loader:Loader = new Loader(); | |
| loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit); | |
| loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3")); | |
| function onLoaderInit(event:Event):void { | |
| youTuba.addChild(loader); // MovieClip (Objeto) onde será carregado o vídeo | |
| loader.content.addEventListener("onReady", onPlayerReady); | |
| } | |
| function onPlayerReady(event:Event):void { | |
| trace("Ready"); | |
| videoPlayer = loader.content; | |
| videoPlayer.setSize(220, 120); // Tamanho do vídeo | |
| videoPlayer.cueVideoByUrl("http://www.youtube.com/v/OUdoEoy2dbo", 0);// Endereço do vídeo | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment