PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Position Embedded Youtube
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Position Embedded Youtube

  1. #1
    Junior Member
    Join Date
    Mar 2010

    Position Embedded Youtube


    I have a flash site, on one of the pages is an embedded youtube video, that I have used this code for
    Actionscript 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
        loadInterval = setInterval(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);

    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();

    // load the player
    ytPlayerLoader.loadClip("", ytplayer);

    The video loads perfectly, however, it is anchored to the top left hand corner. I have attempted to do this within a movieclip and move the movie clip around on the stage also but it has not worked, can anyone let me know how I would do this?

  2. #2
    Join Date
    Sep 2010
    use _x= 0 _y = 0

    ytpayer._x= 20;

    if you wanted to move it around with a movieclip you would make a movie clip and give it a instance name of ytplayer then remove the line

    // create a MovieClip to load the player into
    var ytplayer:MovieClip = _root.createEmptyMovieClip("ytplayer", 1);
    WiiStream A Social Movie Network Version 0.1.1 Demo Testers Aproved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center