?
Solved

How to unload a movie ?

Posted on 2011-02-15
8
Medium Priority
?
314 Views
Last Modified: 2012-05-11
HI

I am loading a movie over a container like this:
function containYoutube(youtubevar, depthLevel) {
      this.createEmptyMovieClip("youtubecontainer",depthLevel);
      this.youtubecontainer.loadMovie("http://www.youtube.com/v/"+youtubevar);
}

but different videos are loaded at the same time in the same container, so I believe I should perform an instruction that could delete the instance created by createEmptyMovieClip in the previous event.

How to do that ?

Thanks
0
Comment
Question by:dimensionav
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 18

Expert Comment

by:Antonio Estrada
ID: 34901207
Try

removeMovieClip(this.youtubecontainer);

That should work.

Good luck,
-V
0
 

Author Comment

by:dimensionav
ID: 34958789
I have on release event the following:

on (release)
{
      Security.allowDomain('http://www.youtube.com');
      Security.allowDomain('http://gdata.youtube.com');
      Security.allowInsecureDomain('http://gdata.youtube.com');
      Security.allowInsecureDomain('http://www.youtube.com');
      
      function containYoutube(youtubevar, depthLevel) {
            removeMovieClip(mcDestino);
            mcDestino.createEmptyMovieClip("youtubecontainer",depthLevel);
            mcDestino.youtubecontainer.loadMovie("http://www.youtube.com/v/"+youtubevar);
      }
      
      containYoutube("my string of URL video", mcDestino.getNextHighestDepth());
}

After clicking in different buttons the previous video is still loaded and it plays at the same time of new ones.
0
 

Author Comment

by:dimensionav
ID: 34958800
The buttons and the video container are in the same level (inside other movieclips)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Expert Comment

by:Antonio Estrada
ID: 34961732
That's odd, how about

removeMovieClip(mcDestino.youtubecontainer);
unloadMovie(mcDestino.youtubecontainer);

If this doesn't work, can you upload your fla so I can take a look at it?

Good luck.

-V
0
 

Author Comment

by:dimensionav
ID: 34965575
The file has confidential content, could I send it to you by email?
0
 
LVL 18

Expert Comment

by:Antonio Estrada
ID: 34965653
Sure thing, you can look it up on my profile.

-V
0
 

Author Comment

by:dimensionav
ID: 34968731
Sent
0
 
LVL 18

Accepted Solution

by:
Antonio Estrada earned 2000 total points
ID: 34976845
Ok so here's a working version.

You need to delete all the code that you have on each button (all those on(release)), name them "btn1" for the first one, "btn2" and so on. Then add a new layer on the main timeline, there add the code (just like you have it on mcDestino, which should also go away).

Then add this code:

var ytLoader:MovieClipLoader = new MovieClipLoader();
var listener:Object = new Object();
var dataArray:Array = [{id: 1, link: "link1"},
					   {id: 2, link: "link2"},
					   {id: 3, link: "link3"},
					   {id: 4, link: "link4"},
					   {id: 5, link: "link5"}];
      
startUp();

function startUp():Void
{
	Security.allowDomain('http://www.youtube.com');
	Security.allowDomain('http://gdata.youtube.com');
	Security.allowInsecureDomain('http://gdata.youtube.com');
	Security.allowInsecureDomain('http://www.youtube.com');
	listener.onLoadComplete = videoLoaded;
	ytLoader.addListener(listener);
	var n:Number = dataArray.length;
	for(var i:Number = 1; i <= n; i++)
	{
		this["btn" + i].onRelease = loadYouTubeVideo;
		this["btn" + i].link = dataArray[i - 1].link;
	}
	loadVideo(dataArray[0].link);
}

function loadYouTubeVideo():Void
{
	mcDestino.destroy();
	loadVideo(this.link);
}

function loadVideo(cLink:String):Void
{
	ytLoader.loadClip("http://www.youtube.com/v/" + cLink, mcDestino);
}

Open in new window


Replace "link1" with the actual link.

Good luck!
-V
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question