# Help with transitions for randomly loading external swf as backgrounds

**URL:** <https://forum.kirupa.com/t/help-with-transitions-for-randomly-loading-external-swf-as-backgrounds/215397>\
**Category:** Uncategorized\
**Created:** [February 7, 2007, 1:25am UTC](https://forum.kirupa.com/t/help-with-transitions-for-randomly-loading-external-swf-as-backgrounds/215397 "2007-02-07T01:25:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![scotcharles](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/scotcharles/32/3285_2.png) [@scotcharles](https://forum.kirupa.com/u/scotcharles)\
**Post date:** [February 7, 2007, 1:25am UTC](https://forum.kirupa.com/t/help-with-transitions-for-randomly-loading-external-swf-as-backgrounds/215397/1 "2007-02-07T01:25:01Z")

</div>

Hi there,  
I hope someone out there can help me. I am using flash 8 and am fairly new to actionscript. I have successfully coded my backgrounds to randomly change every minute. The problem is trying to code it so they fade in and fade out. I have searched and posted on various forums, and there are lots of posts on fade transitions with buttons, but that is not what I am looking for. I will post my code and if anyone could help me with integrating a fade in and fade out I would greatly appreciate it. I should not that my external files are a few lines of code, that generate a gradient to fill the stage, the site will be a full browser flash site.

//have a random number between 1 and 10  
var randomNumber:Number;  
// set interval… for x minutes  
var id:Number = setInterval(this,“loadfunction”, 60000);  
// make a function with a switch that takes a random number  
// and loads a movie

function loadfunction(){  
randomNumber = int(Math.random()\*10);

switch(randomNumber){

case 1:  
loadMovie(“bg1.swf”, 1);  
break;

case 2:  
loadMovie(“bg2.swf”, 1);  
break;

case 3:  
loadMovie(“bg3.swf”, 1);  
break;

case 4:  
loadMovie(“bg4.swf”, 1);  
break;

case 5:  
loadMovie(“bg5.swf”, 1);  
break;

case 6:  
loadMovie(“bg6.swf”, 1);  
break;

case 7:  
loadMovie(“bg7.swf”, 1);  
break;

case 8:  
loadMovie(“bg8.swf”, 1);  
break;

case 9:  
loadMovie(“bg9.swf”, 1);  
break;

case 10:  
loadMovie(“bg10.swf”, 1);  
break;

}  
}  
loadfunction();  
Again I would greatly appreciate any help, as I am pretty confused.  
Cheers
