Skip to main content
Participant
March 19, 2008
Question

Fading a movie clip into another?

  • March 19, 2008
  • 1 reply
  • 451 views
I'm looking for a way to fade a movie clip to another movie clip upon mouse over by the user.
Possible with AS 3.0 or do i need to just tween them somehow?
What's easier?

For instance ...

I have a black square with the text "print" over the middle.
I want it to fade into an sample of one of my prints that i've made when the user mouses over it and yet still be a button so they can click on it to go to my print's page.
This topic has been closed for replies.

1 reply

Known Participant
March 19, 2008
One way -- sorry I don't have sample code, you'll have to read up in the docs --

Make two symbols -- one is your button, one is whatever you want to show under it, whether dynamic or static. Put them on the stage at the same location, with the button on top of the print. So normally all you see is the button.

Create a routine and make it a listener for the mouseover event for the button. In this routine, kick off a timer and make every tick call another routine.

In the final routine, change the value of alpha of the button. It starts out at 1, and you can subtract something like 0.15 every time the timer ticks (e.g. Print_btn.alpha -= 0.15; if (Print_btn.alpha < 0) Print_btn.alpha = 0;). As the alpha of the button decreases, the underlying graphic gets more and more visible. By the time the alpha of the button is zero, the button has disappeared and all you see is the underlying graphic. But the button is still a button and still active, so its click handler will still happen when the user clicks.

You need a different listener for the mouseout event, which will restore the alpha of the button to 1 and kill the timer that was ticking and calling the routine that reduced alpha.

Hope this helps, I'm sure there are other ways as well -- sounds like a neat effect, let me know if you get it working --

Bob
rohicksAuthor
Participant
March 19, 2008
^ yes i did get it working (about 30 minutes after i posted this), but i did it a bit differently than you stated.

I made two movie clips.
I then put the one clip that i wanted to fade into inside the original clip that will load upon page load up.
I then tweened the clip to fade to the out to alpha 0% and had another layer underneath it which contained the clip i was fading to and i just had it run through the frames behind it the whole time (so it was there just hidden and then revealed as the alpha went to 0% on the layer above it).
Then i used stop (); to stop the frames.
Then did the tween over again just reversing the frames and at the last frame of those put a gotoAndStop (1);

Then the code i used for all of this to get to fade in and out upon mouse over was the following (this is for 3 different buttons that are on stage).
My only problem now is; is that i can not get the buttons to load the child (or the gallery i want to come up) on screen.
I don't get any errors it just sits there and does nothing .... BLAH!!!!!
I gotta have this done by Friday and I'm pulling my hair out.
I'm very new to AS 3.0 let alone AS in general and this has been a big learning experience to get this website done.
Example of running swf is located here ...
http://web.ics.purdue.edu/~rohicks/v2/