Copy link to clipboard
Copied
Can anybody tell me what I am doing wrong.
I drug an FLVPlayback to the stage, made it a movie clip and gave it an instance name of my_player then put in the code below and I get the following error.
Security.allowDomain("www.youtube.com");
var my_playerbject;
var my_loader:Loader = new Loader();
my_loader.load(new URLRequest("https://www.youtube.com/watch?v=dnkTYGkoUEc"));
my_loader.contentLoaderInfo.addEventListener(Event .INIT, onLoaderInit);
function onLoaderInit(e:Event):void{
addChild(my_loader);
my_player = my_loader.content;
my_player.addEventListener("onReady", onPlayerReady);
}
function onPlayerReady(e:Event):void{
my_player.setSize(640,360);
my_player.cueVideoById("dnkTYGkoUEc",0);
}
Copy link to clipboard
Copied
remove the flvplayback component from your library.
try:
Security.allowDomain("www.youtube.com");
var my_player:Object;
var my_loader:Loader = new Loader();
my_loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));
my_loader.contentLoaderInfo.addEventListener(Event .INIT, onLoaderInit);
function onLoaderInit(e:Event):void{
addChild(my_loader);
my_player = my_loader.content;
my_player.addEventListener("onReady", onPlayerReady);
}
function onPlayerReady(e:Event):void{
my_player.setSize(640,360);
my_player.cueVideoById("dnkTYGkoUEc",0);
}
Copy link to clipboard
Copied
That works great but it pops up in the upper screen left corner is there any way I can get it to the center of the stage?
Copy link to clipboard
Copied
i'm sure there is. just check the google api.
(p.s when using the adobe forums, please mark helpful/correct responses, if there are any.)
Find more inspiration, events, and resources on the new Adobe Community
Explore Now