Ahmed Nuaman


builder of internets ~ developer of dreams ~ tamer of Dachshunds

Did Someone Order Multiple YouTube Players?

So, here I am, playing with YouTube players, trying to get more than one to load in Actionscript 3. But it’s a pain, so I did a few tests and got it running fine in Actionscript 2.

My aim is to port this to Actionscript 3, but the biggest problem is the handling of the AVMs. I’ve got some tests to do to figure out the best way to separate the content, but hopefully I should have it done soon, so do watch this space. But, for all you lot out there, here’s some old school Actionscript 2 code:

import com.tangozebra.youtube.TZYouTubePlayer;

class MultipleYouTubePlayers
{
    private var parent:MovieClip;
   
    public function MultipleYouTubePlayers(parent:MovieClip)
    {
        System.security.allowDomain( '*' );
        System.security.allowDomain( 'www.youtube.com' );
        System.security.allowDomain( 'youtube.com' );
        System.security.allowDomain( 's.ytimg.com' );
        System.security.allowDomain( 'i.ytimg.com' );
       
        Stage.align         = 'tl';
        Stage.scaleMode     = 'noScale';
       
        this.parent         = parent;
       
        init();
    }
   
    private function init():Void
    {
        var mc1:MovieClip = parent.createEmptyMovieClip( 'mc1', parent.getNextHighestDepth() );
        var mc2:MovieClip = parent.createEmptyMovieClip( 'mc2', parent.getNextHighestDepth() );
        var mc3:MovieClip = parent.createEmptyMovieClip( 'mc3', parent.getNextHighestDepth() );
       
        var player1:TZYouTubePlayer = new TZYouTubePlayer( mc1 );
        var player2:TZYouTubePlayer = new TZYouTubePlayer( mc2 );
        var player3:TZYouTubePlayer = new TZYouTubePlayer( mc3 );
       
        player1.init( 'ghqjailPGOQ' );
        player2.init( 'C54wqJBxrWg' );
        player3.init( 'yU5W4CkZHHQ' );
       
        mc1._y  = 0;
        mc2._y  = player1.playerHeight + 10;
        mc3._y  = ( player1.playerHeight + 10 ) * 2;
    }
}

And this is what it gives you:

But I need to port it to Actionscript 3, so not quite done there!!

Where have comments gone?

Good question my old fruity. I'm now sticking any post discussions on Google+. Why? Well simply it's better. WordPress's comment system isn't very elegant and nor are ones like Disqus or Livefyre, so to save hassle I've just shipped them off to a social network, like a real boss.

Search

My social skills

Latest blog posts

  • Loading posts...

Subscribe in a reader

Latest tweets

  • Loading tweets...