[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to unload a movie ?

Posted on 2011-02-15
8
Medium Priority
?
315 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
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!

 
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

650 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