Thursday, March 8, 2012

[YouTube-API] Re: API Flash (AS2) Special Function player.destroy() not working

Hello Jeff!!!

When I update to version=3 of the player, I resolve the issue of the function player.destroy () but the youtube player doesn´t load in the web.
But If I change to versión=2 of the player, youtube playerand video are loaded in the web but  the function player.destroy () don´t works again

All the web site is made with AS2 and I use the following as2 code to load the player and video:

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

ytplayer._x = 396.0;
ytplayer._y = 225.0;
ytplayer.setSize(480,355);
ytplayer._xscale = 101.5;
ytplayer._yscale = 100.0;

// load the player
ytPlayerLoader.loadClip("http://www.youtube.com/v/qzIAZPkCWfE?hd=1&autoplay=1", ytplayer);

Thanks for you time!!!!!!




El miércoles 7 de marzo de 2012 21:28:57 UTC+1, Jeffrey Posnick escribió:
Hello Gato,

 I'm not sure if you attached photos to your mail, but they didn't
come through to the Google Group.

 Anyway, does updating to version=3 of the player resolve the issue
for you?

Cheers,
-Jeff Posnick, YouTube API Team
groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
@YouTubeDev


On Mar 6, 3:43 pm, Gato Muñoz <gatomu...@gmail.com> wrote:
> When I load any of the videos to the web I created close botton that
> ejecute the following action :
>
> on (release) {
> _root.ytplayer.destroy();
> _root.gotoAndPlay(3);
>
> }
>
> It´s function worked ok (unload the video and go to fotogram 3) but since
> several days ago when a release the close button the function not works (go
> to fotogram 3 butnot unload the video) . I didn´t change nothing in the code
> You can check this behaviour in section videos of the web site..........
>
> thank a lot and sorry for my bad english!!!!!
>
> El lunes 5 de marzo de 2012 22:53:08 UTC+1, Jeffrey Posnick escribió:
>
>
>
>
>
>
>
>
>
>
>
> > Hello,
>
> >  What behavior are you seeing exactly? Flash runtime errors?
>
> >  I'd strongly recommend upgrading to the AS3 player (add version=3 to
> > the URL) as the AS2 player has been deprecated for quite a while now.
>
> > Cheers,
> > -Jeff Posnick, YouTube API Team
> > groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
> > @YouTubeDev
>
> > On Mar 3, 11:13 am, Gato Muñoz <gatomu...@gmail.com> wrote:
> > > Since yesterday, I have problems to unload youtube player instances
> > > embedded in Flash web site (www.gatomuñoz.com<http://www.xn--gatomuoz-i3a.com>).
>
> > > All videos are loaded ok but it´s not possible to unload the youtube
> > player
>
> > > Thanks!
>
> El lunes 5 de marzo de 2012 22:53:08 UTC+1, Jeffrey Posnick escribió:
>
>
>
>
>
>
>
>
>
> > Hello,
>
> >  What behavior are you seeing exactly? Flash runtime errors?
>
> >  I'd strongly recommend upgrading to the AS3 player (add version=3 to
> > the URL) as the AS2 player has been deprecated for quite a while now.
>
> > Cheers,
> > -Jeff Posnick, YouTube API Team
> > groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
> > @YouTubeDev
>
> > On Mar 3, 11:13 am, Gato Muñoz <gatomu...@gmail.com> wrote:
> > > Since yesterday, I have problems to unload youtube player instances
> > > embedded in Flash web site (www.gatomuñoz.com<http://www.xn--gatomuoz-i3a.com>).
>
> > > All videos are loaded ok but it´s not possible to unload the youtube
> > player
>
> > > Thanks!

--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/youtube-api-gdata/-/oQ-4pslbh4MJ.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.

No comments:

Post a Comment