# \[FMX\]Load movie in container with fade in fade out?

**URL:** https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484
**Category:** Uncategorized
**Created:** [August 28, 2004, 5:36am UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484 "2004-08-28T05:36:48Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![dboers](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dboers](https://forum.kirupa.com/u/dboers)
#### Post date: [August 28, 2004, 5:36am UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/1 "2004-08-28T05:36:48Z")

</div>

Hi,

I have a menu (mc\_menu) with 6 button mc’s (btn\_home, btn\_about, …btn\_contact) I also have 6 containerson the stage (content\_home, content\_about, …content\_contact)

Right now I’m loading different external swf’s(home, about,…contact) with the following AS code:

```auto
function pagina(page) {
showContent(page);
}
function showContent(page) {
var c = this["content_"+page];
for (var i in this) {
if (this*._name.substr(0, 8) == "content_") {
this*._visible = (this*._name.substr(8) == page);
c.loadMovie(page+".swf");
}
loadingPage = page;
}
}

```

and on the buttons I call that functions:

```auto
function setButton() {
for (var i in menuMc) {
if (menuMc*._name.substr(0, 4) == "btn_") {
clip = menuMc*;
//RollOver and RollOut stuf goes here
clip.onRelease = function() {
	[color=red]pagina(this._name.substr(4));[/color]
};
}
}
}

```

But I want the external swf’s to load in just one container with fade in and fade out. How can I reach this?

Thanks in advance

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 29, 2004, 4:34am UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/2 "2004-08-29T04:34:58Z")

</div>

It already would be helpful if I only have the fuction for the loadMovie wich goes with my button function.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 29, 2004, 1:47pm UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/3 "2004-08-29T13:47:39Z")

</div>

Is this so dificult that knowbody knows how to do it ?? Are there maybe some sugestions where I can look for the answers?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 29, 2004, 2:05pm UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/4 "2004-08-29T14:05:17Z")

</div>

Look out in the flash samples installed on your hdd :)… you should have there a LoadMovie feature explained with all the as for fade in fade out.  
Help \> Samples 😉

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 30, 2004, 4:50am UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/5 "2004-08-30T04:50:45Z")

</div>

I know that sample but I need something that goes along with my button function. In my case all external swf’s have different names!  
But thanks anyway

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 30, 2004, 7:38am UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/6 "2004-08-30T07:38:57Z")

</div>

Have a look at the Photogallery tut, you can use that with a simple modification and then use this in your code (instead of the loadMovie)

```auto
c.changePhoto(page+".swf");

```

scotty(-:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 30, 2004, 7:48am UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/7 "2004-08-30T07:48:44Z")

</div>

Thanks scotty,

Which Photogallery tut do you mean?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 30, 2004, 8:05am UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/8 "2004-08-30T08:05:11Z")

</div>

[http://www.kirupa.com/developer/mx/photogallery.htm](http://www.kirupa.com/developer/mx/photogallery.htm)  
Change the code igave you before like this:

```auto
_root.changePhoto(page+".swf");

```

and the gallery code like this:

```auto
this.fadeSpeed = 20;
MovieClip.prototype.changePhoto = function(pic) {
	this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
	if (this.c._alpha>this.fadeSpeed) {
		this.c._alpha -= this.fadeSpeed;
	} else {
		this.loadPhoto();
	}
};
MovieClip.prototype.loadPhoto = function() {
	this.c._alpha = 0;
	this.c.loadMovie(pic);
	this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
	var l, t;
	l = this.c.getBytesLoaded();
	t = this.c.getBytesTotal();
	if (t>0 && t == l) {
		this.onEnterFrame = fadeIn;
	} else {
		trace(l/t);
	}
};
MovieClip.prototype.fadeIn = function() {
	if (this.c._alpha<100-this.fadeSpeed) {
		this.c._alpha += this.fadeSpeed;
	} else {
		this.c._alpha = 100;
		this.onEnterFrame = null;
	}
};

```

I hope (didn’t test it) that it’ll work:)

scotty(-:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 30, 2004, 9:28am UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/9 "2004-08-30T09:28:10Z")

</div>

Thanks scotty I will give it a try 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 30, 2004, 9:50am UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/10 "2004-08-30T09:50:56Z")

</div>

welcome, let me know if it worked;)

scotty(-:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 1, 2004, 5:15am UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/11 "2004-09-01T05:15:27Z")

</div>

Hi scotty,

I can’t get it to work as yet. One question to make sure I understand what I should do. Do I still need the function [color=red]showContent,[/color] because that part is with the seperate content\_mc’s, and I would like to work with just one container. I’m a bid confused? because in the tut the container color=red[/color] is declared in the [color=red]prototype loadPhoto[/color] (var p = \_root.photo;) so I don’t know how to continiue?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 1, 2004, 8:44am UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/12 "2004-09-01T08:44:43Z")

</div>

You need the showContent, in that function you call the changePhoto:

```auto
_root.changePhoto(page+".swf");

```

In the tut they’ve used “photo”, if you look at the code in post#8, you’ll see I’ve changed that in your mc “c”.  
So if you add that code, it should work… (like I’ve said before, I didn’t test it;) )

scotty(-:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 1, 2004, 11:54am UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/13 "2004-09-01T11:54:06Z")

</div>

Thanks 🙂 But what should come instead of:

```auto
for (var i in this) {
if (this*._name.substr(0, 8) == "content_") {
this*._visible = (this*._name.substr(8) == page);

```

Where is the container coming in place?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 1, 2004, 1:29pm UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/14 "2004-09-01T13:29:04Z")

</div>

Your code should look like

```auto
function pagina(page) {
	showContent(page);
}
function showContent(page) {
	var c = this["content_"+page];
	for (var i in this) {
		if (this*._name.substr(0, 8) == "content_") {
			this*._visible = (this*._name.substr(8) == page);
			_root.changePhoto(page+".swf");
		}
		loadingPage = page;
	}
}

```

If you use this with my gallery code, there is a chance it’ll work, LOL.  
the container has an instancename “c”.  
If you cant get it working, post a .fla?

scotty(-:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 1, 2004, 2:42pm UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/15 "2004-09-01T14:42:11Z")

</div>

Hi scotty,

Thanks for the patience  
Sorry but I don’t understand the part with content\_.I tried it with just one container (content) and I tried it with a content\_ container for every seperate swf but it doesn’t work. HeI have send the zip by email becauseI couln’t get it smal enough to attach it here

Thanks in advance

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 1, 2004, 3:58pm UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/16 "2004-09-01T15:58:02Z")

</div>

Hey dboers,

Check your mail=)

scotty(-:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 2, 2004, 5:44am UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/17 "2004-09-02T05:44:45Z")

</div>

Hi scotty,

I checked my mail and also the fla. At first I couln’t open it MX 2004, But after I installed that I could open it and it works great.

1000 times thanks 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 2, 2004, 6:37am UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/18 "2004-09-02T06:37:55Z")

</div>

no problem:)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 2, 2004, 12:15pm UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/19 "2004-09-02T12:15:50Z")

</div>

you can add an additional parameter to your function like this:

```auto

MovieClip.prototype.changePhoto = function(my_pic,my_where) {
	this.picToLoad = my_pic;
	this.whereToLoad = my_where;
	this.onEnterFrame = fadeOut;
};

```

and then modify the load movie part like so:

```auto

MovieClip.prototype.loadPhoto2 = function() {
	// specify the movieclip to load images into
	var p = this.whereToLoad;
	//------------------------------------------
	p._alpha = 0;
	p.loadMovie(this.picToLoad);
	this.onEnterFrame = loadMeter;
};

```

that should do it. now you call the function with two parameters, the item you want to load, and which container you want to load it into. you call the function like this:

```auto

_root.changePhoto(yourPicture.jpg,yourContainerMovie);

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 2, 2004, 1:22pm UTC](https://forum.kirupa.com/t/fmx-load-movie-in-container-with-fade-in-fade-out/62484/20 "2004-09-02T13:22:37Z")

</div>

Hi treatkor,

Thanks a lot for this additional information, very helpfull 🙂
