开发者

Multiple loadmovie() ends up with multiple videos played at the same time!

i use loadmovie() to load youtube videos inside my flash website but when i load another video the old one doesn't stop, so i tried unloadmovie to destroy it but it seems that i did a mistake in my code

This is how the code looks开发者_如何学JAVA to stop the old one an load the new:

vloader.unloadMovie();
vloader.loadMovie("http://www.youtube.com/v/Alw5hs0chj0&hl=fr&fs=1hJ-mPcGtC");

How to do that? please don't suggest me to use other objects or classes, i only want to edit that code.

Note: I have an empty MOVIE CLIP called "vloader" where i load the video player.

Thank you


try manually calling .stop() first.


Is this both AS2 and AS3 files in your project ?

From Adobe's Site : http://www.adobe.com/devnet/flash/articles/first_as3_application_04.html

Loading images and SWF files is no longer handled using the loadMovie method or MovieClipLoader class. Instead, use the URLRequest class and the Loader class to accomplish the same task.

The following code shows the bare bones of an image loader [Dropped in your youtube link] script:

import flash.display.Loader;
import flash.net.URLRequest;

var request:URLRequest = new URLRequest("http://www.youtube.com/v/Alw5hs0chj0&hl=fr&fs=1hJ-mPcGtC");
var loader:Loader = new Loader();
loader.load(request);
addChild(loader);

Unless you really do not want to work with API's...

You should check YouTube ActionScript 3.0 Player API Reference

Good Luck !

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜