Groups | Blog | Home
all groups > flash actionscript > march 2006 >

flash actionscript : how do i alter this script to make a movie fade ?


Mannix
3/22/2006 3:07:35 PM
Try this:

on (release) {
_parent./WA.onEnterFrame = function(){ // Set "_parent./WA"
to wherever your Movie Clip is
if(this._alpha !=0){
this._alpha -= 5;
}else{
delete this.onEnterFrame;
}
}
}

Hope that helps,
Mannix
tralfaz
3/22/2006 3:08:54 PM

[quoted text, click to view]

You could use an interval timer..

on(release)
{
id1 = setInterval(fadeOut, 10);

function fadeOut()
{
WA._alpha-=2;
if(WA._alpha < 1)
{
clearInterval(id1);
}
}
}

HTH
tralfaz

tralfaz
3/22/2006 4:12:26 PM
[quoted text, click to view]

You really don't need to create any new movieclips to fade out one
that already exists.
Using the simple example I posted earlier..
http://members.cox.net/4my5cats/fadeInOut.html
tralfaz

bwclan
3/22/2006 10:49:08 PM
hi all , this script makes the movie dissapear instantly ... what iwant is for
it to fade out smoothly (cant use tweening cos of the script i think) heres the
script on the close button

on (release) {
setProperty("/WA", _visible, "0");
}

any help much appreciated
craig
SomeTallGy
3/22/2006 11:07:02 PM
You can try running a script through creating an empty movieclip to dim the
alpha of the movieclip you want to fade.

on (release){
this.createEmptyMovieClip("fade", this.getNextHighestDepth());
fade.onEnterFrame = function(){
if(_root.WA._alpha <= 0){
_root.WA._alpha -= 10; // set this number higher for faster fade
} else {
unloadMovie(this); // unloads the created movieclip once it has finished
}
}

Thats how I usually do it, hope this helps!

Cheers.

PS. I wrote this code off the top of my head, so double check the syntax when
you cut and paste :)
bwclan
3/22/2006 11:29:58 PM
cheers stg ... cant get it to work tho .... there are a couple of syntax errors
reported but i cant work out what they are to fix them lol !! when you say
create an empty mc, do you mean within the button ? or on the timeline ?
cheers for your input though mate
craig
SomeTallGy
3/22/2006 11:37:40 PM
you can create empty movie clips dynamically either on the timeline or in any
movieclip. So if you want to make on on the main timeline you

_root.createEmptyMovieClip("fade", this.getNextHighestDepth());

probably not working as "this" is probably trying to make the movieclip within
the button which I think will not work.

if you wanted to make on on the level(s) below.. use _parent or
_parent._parent and so on.
kapturedsoul
3/31/2006 10:14:33 PM
I like how the movie fades out, but is there anyway to unload the entire flash
object? Say there was something that you want to show in that same place where
the object is after it disappears, but it is not something you can do in flash.
AddThis Social Bookmark Button