Hi there. I’ve got a fla setup that is loading the Youtube API. It works brilliantly except for also on stage I’d like to include a Youtube gallery of thumbnails. There are some documentation in the Google Developers forum however I need help getting it to work. If anyone has an idea let me know!
[COLOR=#333333][FONT=adobe-clean]Hello. I've currently got a nice little file setup that pulls in a youtube video. I'd like to setup additional images that pull in thumbnails in a different area of the stage, that will act as buttons and load and play the fullsized video. I'm used the version of the youtube player that has the defaul buttons. Here is the code I have so far:[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]import flash.display.Loader;[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]import flash.net.URLRequest;[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]import flash.events.Event;[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]import flash.system.Security;[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]import flash.display.DisplayObject;[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]import flash.display.Sprite;[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]Security.allowDomain("www.youtube.com");[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]Security.allowInsecureDomain("www.youtube.com");[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]Security.allowDomain("[http://s.ytimg.com](http://s.ytimg.com/)");[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]Security.allowDomain("i.ytimg.com");[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]Security.allowDomain("s.youtube.com");[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]var vid_player:Object;[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]var thumb1:Object;[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]var my_loader:Loader = new Loader();[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]my_loader.load(new URLRequest("http://www.youtube.com/v/GctR_uzuNvw?version=3"));[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]my_loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]function onLoaderInit(e:Event):void{[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] addChild(my_loader);[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] vid_player = my_loader.content;[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] vid_player.addEventListener("onReady", onPlayerReady);[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] my_loader.content.addEventListener("onReady", onPlayerReady);[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] my_loader.content.addEventListener("onError", onPlayerError);[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] my_loader.content.addEventListener("onStateChange", onPlayerStateChange);[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] my_loader.content.addEventListener("onPlaybackQualityChange",[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] onVideoPlaybackQualityChange)[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]}[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]function onPlayerReady(e:Event):void{[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] vid_player.setSize(415,234);[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] //vid_player.cueVideoById("npvJ9FTgZbM",3);[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] //vid_player.pauseVideo();[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] vid_player.x = 262;[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] vid_player.y = 7;[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] vid_player = my_loader.content;[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]}[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]function createFeaturedButtons(thumb1:Object, featuredVideos:Array) {[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] var results:Array = [];[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] for each (var id:String in featuredVideos) {[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] results.push(thumb1.getClickToPlayButton("bHQqvYy5KYo"));[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] }[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] return results;[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] trace(featuredVideos);[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]}[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]function onPlayerError(event:Event):void {[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] // Event.data contains the event parameter, which is the error code[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] trace("player error:", Object(event).data);[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]}[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]function onPlayerStateChange(event:Event):void {[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] // Event.data contains the event parameter, which is the new player state[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] trace("player state:", Object(event).data);[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]}[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]function onVideoPlaybackQualityChange(event:Event):void {[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] // Event.data contains the event parameter, which is the new video quality[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] trace("video quality:", Object(event).data);[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]}[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]I’m pretty sure the problem is with this code:[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]function createFeaturedButtons(thumb1:Object, featuredVideos:Array) {[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] var results:Array = [];[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] for each (var id:String in featuredVideos) {[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] results.push(thumb1.getClickToPlayButton("bHQqvYy5KYo"));[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] }[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] return results;[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean] trace(featuredVideos);[/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]} [/FONT][/COLOR]
[COLOR=#333333][FONT=adobe-clean]I don’t seem to have that quite setup right. Please any help would be greatly appreciated. How do I get the thumbnails to display?[/FONT][/COLOR]