Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 05-31-2012, 06:41 PM   #1
steelbydesign
Registered User
 
Join Date: May 2012
Posts: 1
Default Fading mc's on and off with rollover's

So I'm making a banner ad with some disclaimer text at the end that I want to fade on (replacing some other text) when the user rolls over a small button, and I want it to go back to how it was when the user rolls out of the stage all together...


• Right now I have a button that covers the whole stage (to detect roll over for a button animation and it has some click through text), and that's called hit_mc

• I also have a small button that I want to activate the text fade out and the disclaimer fade on. That's called rulesBtn

• So when the user rolls over rulesBtn I want text02_mc and text03_mc to do an alpha fade out, and disclaimer_mc to fade on.

• THEN when the user rolls off the stage all together, or off of hit_mc it would do the opposite, meaning disclaimer_mc would fade off and the two text movie clips would fade back on.



I tend to animate but I'm terrible with action script. Any help would be GREATLY appreciated.
steelbydesign is offline   Reply With Quote
Old 05-31-2012, 07:38 PM   #2
dmb85
TweenMax Salesman
 
Join Date: Jan 2012
Posts: 487
Default

Go get the greensock tweening platform: http://www.greensock.com/tweennano/. Put the "com" folder next to your .fla.

Then to tell something to fade out over a specified amount of time, you'd do something like:

ActionScript Code:
//Since you're making a web banner, we use the TweenNano class which is the smallest in size import com.greensock.TweenNano; rulesBtn.onClick = function () {    TweenNano.to(text02_mc, 0.5, {_alpha:0}); //Tweens the object to alpha 0, over 0.5 seconds    TweenNano.to(text03_mc, 0.5, {_alpha:0}); //Tweens the object to alpha 0, over 0.5 seconds    TweenNano.to(disclaimer_mc, 0.5, {_alpha:100}); //Tweens the object to alpha 100, over 0.5 seconds }
dmb85 is offline   Reply With Quote
Old 05-31-2012, 10:05 PM   #3
neilmmm
Senior Member
 
neilmmm's Avatar
 
Join Date: Oct 2005
Location: dorset
Posts: 1,636
Default

Code:
disclaimer_mc._alpha = 0;
fadeAmount = 2;
hit_mc.onRollOver = function() {
	this.onEnterFrame = function() {
		text02_mc._alpha -= fadeAmount;
		text03_mc._alpha -= fadeAmount;
		disclaimer_mc._alpha += fadeAmount;
		if (text02_mc._alpha<=1) {
			text02_mc._alpha = 0;
			text03_mc._alpha = 0;
			disclaimer_mc._alpha = 100;
			delete this.onEnterFrame;
		}
	};
};
hit_mc.onRollOut = function() {
	this.onEnterFrame = function() {
		text02_mc._alpha += fadeAmount;
		text03_mc._alpha += fadeAmount;
		disclaimer_mc._alpha -= fadeAmount;
		if (text02_mc._alpha>=99) {
			text02_mc._alpha = 100;
			text03_mc._alpha = 100;
			disclaimer_mc._alpha = 0;
			delete this.onEnterFrame;
		}
	};
};
neilmmm is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:27 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.