LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 




 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-06-2009, 01:48 AM
samuels27921 samuels27921 is offline
Registered User
 
Join Date: Feb 2008
Posts: 3
Rep Power: 0
samuels27921 is on a distinguished road
Youtube Player embedded in Flash

I have embed the youtube flash player via this code.

Code:
// create a MovieClip to load the player into
var ytplayer:MovieClip = _root.createEmptyMovieClip("ytplayer", 1);

// create a listener object for the MovieClipLoader to use
var ytPlayerLoaderListener:Object = {
  onLoadInit: function() {
    // When the player clip first loads, we start an interval to
    // check for when the player is ready
    this.loadInterval = setInterval(this.checkPlayerLoaded, 250);
  }
};

var loadInterval:Number;


function checkPlayerLoaded():Void {
    // once the player is ready, we can subscribe to events, or in the case of
    // the chromeless player, we could load videos
    if (ytplayer.isPlayerLoaded()) {
        ytplayer.addEventListener("onStateChange", onPlayerStateChange);
        ytplayer.addEventListener("onError", onPlayerError);
        clearInterval(loadInterval);
    }
}

function onPlayerStateChange(newState:Number) {
    trace("New player state: "+ newState);
}

function onPlayerError(errorCode:Number) {
    trace("An error occurred: "+ errorCode);
}

// create a MovieClipLoader to handle the loading of the player
var ytPlayerLoader:MovieClipLoader = new MovieClipLoader();
ytPlayerLoader.addListener(ytPlayerLoaderListener);

// load the player
ytPlayerLoader.loadClip("http://www.youtube.com/v/VIDEO_ID", ytplayer);
from http://code.google.com/apis/youtube/...reference.html

I would Like to know, How can I run the destory command because the video keeps playing even though the command has been passed. I've used stopVideo and destory. they dont work until you press the pause button. I would like to end the video even if its playing.
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash Player and ActionScript Sessions at Max 2011 FlashMove General Flash 0 06-27-2011 07:28 PM
Flash Player get an Echo Cancellation. Web-telephony is coming! Flashphoner Apache Flex 1 04-16-2011 04:02 PM
Changes to youtube API allowing easy load into flash [PAUL FERRIE] Flash Video 2 03-14-2008 02:50 PM
Glitch in my first Flash project keress Newbies 8 12-28-2006 02:49 PM
which flash player do i need. jason456 General Flash 1 07-06-2006 03:56 PM




All times are GMT. The time now is 10:04 AM.