PDA

View Full Version : making a movieclip fade out before playing a new one.


bas1c
11-05-2003, 10:01 PM
Hello everyone.

I have 6 buttons and 6 movieclips.

the 6 movieclips are all the same size and they should be displayed in the same little window when its button is clicked.

like this

---------------------------------------------------------

------------------------------
| movieclip inside this window |
------------------------------

button1 button2 button3 button4 button5 button6
---------------------------------------------------------

How can i make the movieclip fade out for 10 frames or so before playing the next one even if its still playing ?

Any script suggestions ?

Sammy.

Colin Campbell
11-05-2003, 10:35 PM
Welcome to the forums!

search the forums. This is quite a common question here, and has been answered many times before. Theres a search you can use, by either going to the bottom of the page, or top. Hope to see you around.

I'll also direct you to this site on posting correctly. Helpful tips (http://www.actionscript.org/forums/showthread.php3?s=&threadid=37043)

Night, Colin.

bas1c
11-05-2003, 11:09 PM
I'll search harder then. can't seem to find it.

if u have an answer please post i anyway. Or an URL to a forum post.

Thanks.

Sammy.

illrainman
11-05-2003, 11:19 PM
I'm not sure on the way to do it with actionscripts, but you could make it a movie clip and fade it in and out at different frames and then make the buttons have a gotoAndPlay(frame) thing pointing to the different frames where the object faded in.

That may be a little confuzing but i think thats what you mean.

bas1c
11-06-2003, 12:16 AM
not really. Because i want the movieclips to fade out even if they are still playing.


here is my site.

now the 6 movieclips are playing in a loop for u to see.

there is no preloader yet so have a little patience. the flash is 189K

PS: maximize the window ;)

http://www.clan-capacity.dk/help/index.htm

oh dear someone please help me :rolleyes:

Sammy :)

agent81
11-06-2003, 01:27 AM
that is a pretty common question, and there are a whole lotta examples out there....

but I'll get you started, cos your animationa are quite nice.

each animation is top left aligned (in its own clip), and given a linkage identifier in the library.

e.g 'movie1', 'movie2','movie3'

etc.

now you need a couple of functions, in your _root timeline



function attachNewMovie{
this.currentMove.removeMovieClip()
dep++
this.currentMovie = this.attachMovie("movie" + num,"movie" + dep,dep)
this.currentMovie._x = 100//whatever you need
this.currentMovie._y= 100//whatever you need
}

MovieClip.prototype.fadeOut = function(num){

this.onEnterFrame = function(){
this._alpha -= 5
if (this._alpha <=5){
this.onEnterFrame = null
_root.attachNewMovie(num)
}
}
}



so when you press a button you can call




//fades out current clip, and loads movie 1
on (release){
currentMovie.fadeOut(1)
}

bas1c
11-06-2003, 11:38 AM
Big thanks to illrainman and agent81.

Ill try it when i come home.. but i think the thread from agent81 is the right solution for me.:)

I have searched the forum but havent got an answer to this. but have learned alot about "this._alpha".

And to colin:
you wrote. "I'll also direct you to this site on posting correctly. Helpful tips"

Didn't i post correctly ? or was it just that u wanted me to see it because im a new member ?

Propably the last i guess.

Sammy ;)

bas1c
11-06-2003, 02:05 PM
hmm, first of all the actionscript should look like this:

function attachNewMovie(){
this.currentMovie.removeMovieClip()
dep++
this.currentMovie = this.attachMovie("movie" + num,"movie" + dep,dep)
this.currentMovie._x = 100
this.currentMovie._y= 100
}

MovieClip.prototype.fadeOut = function(num){

this.onEnterFrame = function(){
this._alpha -= 5
if (this._alpha <=5){
this.onEnterFrame = null
_root.attachNewMovie(num)
}
}
}

----

and on the buttons.
on (release){
currentMovie.fadeOut(1)
}


----

but it deosnt seem to work..

can u make an example for me in a flash file with 2 buttons and 2 movieclips with the code above ?

thanks.

Sammy

agent81
11-06-2003, 05:47 PM
uhh, no i can't, I get paid to do this, so you'd have to have some cashola......

sorry, seriously though, you can do it yourself, somebody should write a tute about debugging. First, track down where the code is breaking. do this using trace, if you put a trace in


function attachNewMovie(){
trace("function ran")
this.currentMovie.removeMovieClip()
dep++
this.currentMovie = this.attachMovie("movie" + num,"movie" + dep,dep)
this.currentMovie._x = 100
this.currentMovie._y= 100
}


thats probably a good starting point, then work forwards or backward, till you find the problem. If you do that, then you'll be able to actually use this code, rather than just copying it.

one thing that i would check, is that your symbol identifiers in the library are set properly.

if you run into a specific problem while doing this, then post back here, I'll guide you through as best as i can

cheers

bas1c
11-06-2003, 07:27 PM
ive searched for 2 days and tried and tried...

if this is such a common problem why the f*># cant I find it ?

geuss ill just have to study actionscript 2.0 before i can make a single homepage :confused:

ill try and try till i get it. but it would be lovely if anybody can help me with a .fla example. im kinda stuck here.

agent81
11-06-2003, 10:34 PM
did you try using trace?

what were the results?

did you check your linkage identifier?

bas1c
11-06-2003, 11:31 PM
i've solved the problem :D i've inkluded a preloader too..

thanx for ur help agent81.

too sad u need money for making a .fla

I would have saved some time. but now i actually understand the code.

sammy :)

agent81
11-07-2003, 02:12 AM
good for you:D :D

ties
05-05-2007, 12:12 AM
Hi bas1c!

Do you mind sharing how you got the problem solved? I can't seem to get it right either ... i'm at the end of trying :confused:

thanks in advance!