header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
Mitchell Banks
Points:0
Posts:0

5/27/2011 1:43:26 PM

Title: student


Hello! I'm using AS2. This is to make the movie clip (startBtn) fade in and out with a mouse over, also, it will bring me to frame 2 when I click on it.



on (release) {

          gotoAndStop(2);

fadeAmount = 20;
function fadeIn() {
startBtn._alpha += fadeAmount;
if (startBtn._alpha>=100) {
startBtn._alpha = 100;
startBtn.onEnterFrame = null;
}
}
function fadeOut() {
startBtn._alpha -= fadeAmount;
if (startBtn._alpha<=0) {
startBtn._alpha = 0;
startBtn.onEnterFrame = null;
}
}
startBtn._alpha = 0;
startBtn.onRollOver = function() {
startBtn.onEnterFrame = fadeIn;
}
startBtn.onRollOut = function() {
startBtn.onEnterFrame = fadeOut;
}
}

Here is the problem... When I use this on a Button - This action script allows me to go to the next frame, but the fade doesn't work. When I use this on a Movie Clip - The fade works, but it doesn't allow me to go to the next frame. Thanks in advance!



1
Inder
Points: 2980
Posts:0
5/28/2011 12:20:23 PM



In movieclip case you are inside movieclip so you need to tell that you want to move the root timeline to next frame for this use _root.gotoAndStop(2);

2
Mitchell Banks
Points: 0
Posts:0
5/28/2011 7:13:55 PM



Sir, you are the boss. Thank you! It worked!

3
Mitchell Banks
Points: 0
Posts:0
5/31/2011 3:01:01 PM



Hello again! Thank you for your help from the last reply by the way. I have one more question regarding multiple movie clip buttons in the same frame in the timeline.

Now that I have the movie clip button working with alpha fades, how do I go about using this on multiple buttons on the same frame? This is what I tried to do below...



fadeAmount = 20;  
function fadeIn() {  
startBtn._alpha += fadeAmount;  
if (startBtn._alpha>=100) {  
startBtn._alpha = 100;  
startBtn.onEnterFrame = null;  
}  
}  
function fadeOut() {  
startBtn._alpha -= fadeAmount;  
if (startBtn._alpha<=0) {  
startBtn._alpha = 0;  
startBtn.onEnterFrame = null;  
}  
}  
startBtn._alpha = 0;  
startBtn.onRollOver = function() {  
startBtn.onEnterFrame = fadeIn;  
}  
startBtn.onRollOut = function() {  
startBtn.onEnterFrame = fadeOut;  
}  

fadeAmount = 10;
function fadeIn() {
continueBtn._alpha += fadeAmount;
if (continueBtn._alpha>=50) {
continueBtn._alpha = 50;
continueBtn.onEnterFrame = null;
	}
}
function fadeOut() {
continueBtn._alpha -= fadeAmount;
if (continueBtn._alpha<=0) {
continueBtn._alpha = 0;
continueBtn.onEnterFrame = null;
	}
}
continueBtn._alpha = 0;
continueBtn.onRollOver = function() {
continueBtn.onEnterFrame = fadeIn;
}
continueBtn.onRollOut = function() {
continueBtn.onEnterFrame = fadeOut;
}

If I add the same code below the original but replace startBtn with continueBtn, I don't get any errors, but the alpha fades stop working properly. Any idea how to resolve this issue? Thanks again in advance!

4
Trillian
Points: 0
Posts:0
6/2/2011 9:42:06 AM



use a different variable for "fadeAmount " like fadeAmount1 for your continueBtn code and it should work


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 2+4 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions