Solved

How to unload a movie ?

Posted on 2011-02-15
8
311 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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 500 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
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 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): …
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

734 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