Question:

Fading in and out in a single frame with ActionScript. Concept learned, mistakes made. Any help?

by  |  earlier

0 LIKES UnLike

'lo. So I'm making this flash application, and for inexplicable reasons I want to contain the entire application within a single frame of a single scene. To do this, I've made movie clips. Basic, right?

Wrong. It turns out I want menus to fade out and into the next one upon the click of a button. I managed to get it so the intro fades in, but I can't manage to get the intro to fade smoothly to the main menu upon the click of an "ENTER" button within the intro movie clip.

For reference, although this part isn't a problem, here's the actionscript for the actions frame of the first and only scene.

intro._alpha=0;

fadeInt = setInterval(fadeIn,10,intro);

function fadeIn(mc)

{

mc._alpha = 7;

if(mc._alpha >= 100)

{

intro._alpha=100;

clearInterval(fadeInt);

}

}

////////////////////////////////////

////////////////////////////////////

And below is the actionscript attached to the "enter" button.

on(release)

{

intro = _root.intro;

varana = _root.varana;

outfade = SetInterval(fadeOut,10,intro2);

function fadeOut(mc)

{

mc._alpha -=10;

if(mc._alpha <= 0)

{

mc.alpha = 0;

clearInterval(outfade);

}

}

wait = setInterval(function()

{

clearInterval(wait);

infade = setInterval(fadeIn,100,varana);

function fadeIn(mc)

{

mc._alpha = 10;

if(mc._alpha >= 100)

{

clearInterval(infade);

mc._alpha = 100;

}

}

}, 100);

}

/////////////////////////

////////////////////////

Now, the movie clips are as follows:

intro

varana

Within intro is the button "intro_enter".

The initial fade-in with the stage's actionscript works perfectly fine. However, for some reason, upon clicking "enter", the intro movie clip doesn't fade out, but after 100 milliseconds the varana movie clip fades in. I've been scouring the script for about half an hour and can't figure out why.

Any guesses?

 Tags:

   Report

2 ANSWERS


  1. Change this line

    outfade = SetInterval(fadeOut,10,intro2);

    to

    outfade = setInterval(fadeOut,10,intro);  //actionscript is case sensitive, variable name consistency

    Hope this helps.


  2. try search on internet.im sure you find it

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions