# Alpha fade using actionspirt

**URL:** <https://forum.kirupa.com/t/alpha-fade-using-actionspirt/38597>\
**Category:** Uncategorized\
**Created:** [December 26, 2003, 11:12am UTC](https://forum.kirupa.com/t/alpha-fade-using-actionspirt/38597 "2003-12-26T11:12:51Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![dreamer](https://avatars.discourse-cdn.com/v4/letter/d/6bbea6/32.png) [@dreamer](https://forum.kirupa.com/u/dreamer)\
**Post date:** [December 26, 2003, 11:12am UTC](https://forum.kirupa.com/t/alpha-fade-using-actionspirt/38597/1 "2003-12-26T11:12:51Z")

</div>

I am using this code:

on (release) {  
unloadMovie(“content”);  
}  
}  
on (release) {  
loadMovie(“linkbank/linkpool/art.swf”, “content”);  
}

However, when it unloads its not smooth, its sudden. How do you made the current object loaded in “content” fade alpha and then once it reach 0 load the next clip? Keeping in mind that i want it all in a scirpt form that i can easy add to a button.

thanks! love ya

---

<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:** [December 26, 2003, 11:47am UTC](https://forum.kirupa.com/t/alpha-fade-using-actionspirt/38597/2 "2003-12-26T11:47:27Z")

</div>

using a for loop, set interval and movieclip.\_alpha from 100 to 0 (when it reaches 0 load the mc)

---

<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:** [December 26, 2003, 11:48am UTC](https://forum.kirupa.com/t/alpha-fade-using-actionspirt/38597/3 "2003-12-26T11:48:58Z")

</div>

```auto

fader = function(what) {
what._aplha > 0 ? what._alpha -= 10 : what.unloadMovie();
}
on (release) {
fader(content);
}

```

ps  
should it also fade in when loading another movie???

---

<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:** [December 27, 2003, 12:30am UTC](https://forum.kirupa.com/t/alpha-fade-using-actionspirt/38597/4 "2003-12-27T00:30:19Z")

</div>

it sats there a syntax errors:  
fader = function(what) {  
what.\_aplha \> 0 ? what.\_alpha -= 10 : what.unloadMovie();  
}  
on (release) {  
fader(content);  
}  
on (release) {  
unloadMovie(“content”);  
}  
on (release) {  
loadMovie(“linkbank/linkpool/art.swf”, “content”);  
}

---

<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:** [December 27, 2003, 12:36am UTC](https://forum.kirupa.com/t/alpha-fade-using-actionspirt/38597/5 "2003-12-27T00:36:13Z")

</div>

I corrected some of the spelling:  
fader = function(“what”) {  
what.\_alpha \> 0 ? what.\_alpha -= 10 : what.unloadMovie();  
}  
on (release) {  
fader(“content”);  
}  
on (release) {  
unloadMovie(“content”);  
}  
on (release) {  
loadMovie(“linkbank/linkpool/art.swf”, “content”);  
}

BUT it still has errors: HERES the output  
Symbol=linkpool main content, Layer=buttons, Frame=1: Line 1: Parameter name expected  
fader = function(“content”) {

Symbol=linkpool main content, Layer=buttons, Frame=1: Line 2: Statement must appear within on handler  
what.\_alpha \> 0 ? what.\_alpha -= 10 : what.unloadMovie();

Symbol=linkpool main content, Layer=buttons, Frame=1: Line 3: Unexpected ‘}’ encountered  
}

---

<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:** [December 27, 2003, 12:40am UTC](https://forum.kirupa.com/t/alpha-fade-using-actionspirt/38597/6 "2003-12-27T00:40:21Z")

</div>

wait… can you make it like you said before. It loads in but fades in but when another button is selected it will fade the current loaded movie and fade in the selected? so that its nice and smooth.

ALSO when preloading my main file is there a way to preload extnernal files?

---

<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:** [December 27, 2003, 1:02am UTC](https://forum.kirupa.com/t/alpha-fade-using-actionspirt/38597/7 "2003-12-27T01:02:48Z")

</div>

```auto
MovieClip.prototype.fadeAndUnload = function(rate) {
	this.onEnterFrame = function() {
		if (this._alpha > 0) {
			this._alpha -= rate;
		} else {
			delete this.onEnterFrame;
this.unloadMovie();
		}
	};
};

```

```auto

myMovieClip.fadeAndUnload(10);

```

---

<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:** [December 27, 2003, 7:00am UTC](https://forum.kirupa.com/t/alpha-fade-using-actionspirt/38597/8 "2003-12-27T07:00:47Z")

</div>

where do i put each script?

---

<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:** [December 27, 2003, 7:08am UTC](https://forum.kirupa.com/t/alpha-fade-using-actionspirt/38597/9 "2003-12-27T07:08:41Z")

</div>

that will fade out the current loaded movie clip i guess. How about loading in the next one automatically after the movie clip has finished fading out?

---

<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:** [December 27, 2003, 3:24pm UTC](https://forum.kirupa.com/t/alpha-fade-using-actionspirt/38597/10 "2003-12-27T15:24:02Z")

</div>

Dreamer, take a look at photogallery tutorial, there’s exactly what you need:whistle:

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:** [December 28, 2003, 12:10am UTC](https://forum.kirupa.com/t/alpha-fade-using-actionspirt/38597/11 "2003-12-28T00:10:28Z")

</div>

KOOL! thanks a lot 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:** [December 28, 2003, 9:52am UTC](https://forum.kirupa.com/t/alpha-fade-using-actionspirt/38597/12 "2003-12-28T09:52:23Z")

</div>

no problem:thumb:
