# Pause between variables?

**URL:** <https://forum.kirupa.com/t/pause-between-variables/310318>\
**Category:** Uncategorized\
**Created:** [June 7, 2010, 5:08pm UTC](https://forum.kirupa.com/t/pause-between-variables/310318 "2010-06-07T17:08:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheMuadib](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/themuadib/32/302_2.png) [@TheMuadib](https://forum.kirupa.com/u/TheMuadib)\
**Post date:** [June 7, 2010, 5:08pm UTC](https://forum.kirupa.com/t/pause-between-variables/310318/1 "2010-06-07T17:08:51Z")

</div>

Hi there,

I’m making a scripted animation in Flash CS4, basically it’s made of various mc’s that have alpha tweens assigned.

The thing is I’m trying to make a FadeIn variable and then wait for “x” seconds then call a fadeOut variable…

the thing is I can’t find code for resting between variables so the closer I got was using set interval but that makes it hard to code.

here is my code

```auto
// IMPORTAR CLASSES
import mx.transitions.Tween;
import mx.transitions.easing.*;

// ESCONDER MCLIPS NO INICIO

justica_mc._alpha = 0;
mario_mc._alpha = 0;
sombra_mc._alpha = 0;
autor_mc._alpha = 0;
tag_mc._alpha = 0;

// FUNÇÕES

function justicaAlpha() {
  var fadeIn:Tween = new Tween(justica_mc, "_alpha", Regular.easeIn, 0, 100, 1, true);
}

function delayJustica () {
	clearInterval(delay1);
      var fadeOut:Tween = new Tween(justica_mc, "_alpha", Regular.easeOut, 100, 0, 1, true); 
      trace( "fadeOut justica" )
      fadeOut.onMotionFinished = function() {
	   unBlur();
   }
}

function unBlur() {
	var fadeOut:Tween = new Tween(blur_mc, "_alpha", Regular.easeOut, 100, 0, 1, true);
	trace ("unBlur")
	fadeOut.onMotionFinished = function() {
	   marioAlpha();
   }
}

function marioAlpha() {
  var fadeIn:Tween = new Tween(mario_mc, "_alpha", Regular.easeIn, 0, 100, 1, true);
  trace ("marioAlpha")
}

function delayMario() {
	clearInterval(delay2);
      var fadeOut:Tween = new Tween(mario_mc, "_alpha", Regular.easeOut, 100, 0, 1, true); 
      trace( "fadeOut mario" )
      fadeOut.onMotionFinished = function() {
	   sombraAlpha();
   }
}

// ANIMAÇÃO

justicaAlpha();
delay1 = setInterval(delayJustica, 2000);
delay2 = setInterval(delayMario, 5500);

```

also I would like this animation to repeat itself after it concludes (looping the code?)

I’m a bit noob at AS animation so bear with me, please 😉
