|
|
#1 |
|
New Member
![]() Join Date: Oct 2010
Posts: 12
|
hi,
I'm making a website with video's (= link to YouTube) and would like to arrange that when you click on the button, containing the URL/link to the video on YouTube, the video opens in a pop up frame with "close X" in the corner, in stead of opening in a new webpage. As is ex.: video opens in a new entire webage http://hd-gametrailers.mastercombo.com/ TO BE: video should pop up in a smaller frame, with "close X" in corner. First video on page with title "Video Weather Forecast" http://www.accuweather.com/en/us/cle...ecast/18887_pc The code linking to the video's on YouTube: Code:
// The player SWF file on www.youtube.com needs to communicate with your host // SWF file. Your code must call Security.allowDomain() to allow this // communication. Security.allowDomain("http://www.youtube.com"); Security.allowDomain("http://s.ytimg.com"); // This will hold the API player instance once it is initialized. var player:Object; var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit); loader.load(new URLRequest("http://www.youtube.com/v/iFcxnkXvaG8?version=3")); function onLoaderInit(event:Event):void { addChild(loader); loader.content.addEventListener("onReady", onPlayerReady); loader.content.addEventListener("onError", onPlayerError); loader.content.addEventListener("onStateChange", onPlayerStateChange); loader.content.addEventListener("onPlaybackQualityChange", onVideoPlaybackQualityChange); } function onPlayerReady(event:Event):void { // Event.data contains the event parameter, which is the Player API ID trace("player ready:", Object(event).data); // Once this event has been dispatched by the player, we can use // cueVideoById, loadVideoById, cueVideoByUrl and loadVideoByUrl // to load a particular YouTube video. player = loader.content; // Set appropriate player dimensions for your application player.setSize(1000,550); } function onPlayerError(event:Event):void { // Event.data contains the event parameter, which is the error code trace("player error:", Object(event).data); } function onPlayerStateChange(event:Event):void { // Event.data contains the event parameter, which is the new player state trace("player state:", Object(event).data); } function onVideoPlaybackQualityChange(event:Event):void { // Event.data contains the event parameter, which is the new video quality trace("video quality:", Object(event).data); } Last edited by Manganix; 11-30-2011 at 07:21 PM. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|