A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Position Embedded Youtube

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    8

    Position Embedded Youtube

    Hi,

    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);
            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/Cmezvqikanc", 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
    Member
    Join Date
    Sep 2010
    Posts
    73
    use _x= 0 _y = 0

    ytpayer._x= 20;
    ytplayer._y=39;


    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 http://wiistream.net/WiiStream.exe

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