views:

187

answers:

2

Hi, 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 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

A: 

try manually calling .stop() first.

JohnFly
Thanks for answer but that doesn't work :(
David
A: 

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 !

phwd