Problem with this code - s.o. pls have a look

ok… i tried to write an AS function, which first fades (zeros alpha) a pic in an MC, then changes the pic and finally raise the alpha value again… as clear as simple… here is my code + my problem:

comments: the mc where the pictures should load is called “bg_pic”


   _global.ChangeBgPic = function()
   {
   //array with all the pics
 	aBgPic = new Array("bg_pics/bg_pic00.jpg","bg_pics/bg_pic01.jpg","bg_pics/bg_pic02.jpg","bg_pics/bg_pic03.jpg","bg_pics/bg_pic04.jpg","bg_pics/bg_pic05.jpg","bg_pics/bg_pic06.jpg","bg_pics/bg_pic07.jpg","bg_pics/bg_pic08.jpg","bg_pics/bg_pic09.jpg","bg_pics/bg_pic10.jpg","bg_pics/bg_pic11.jpg");
   
   // fade (out) current picture (zero alpha)
   	FadeOut = function()
   	{
   		if(bg_pic._alpha > 0)
   		{
   			bg_pic._alpha -= 1;
   		}
   		else
   		{
   			clearInterval(iFadeOut);
   		}
   	}
   	
   	iFadeOut = setInterval(FadeOut,5);
   	
   // load new random picture in mc
   	var i = 0;
   	Math.round(Math.random()*11);
   	loadMovie(aBgPic*,bg_pic);
   	
   // fade (in) new pic (raise alpha again)
   	FadeIn = function()
   	{
   		if(bg_pic._alpha < 100)
   		{
   			bg_pic._alpha += 1;
   		}
   		else
   		{
   			clearInterval(iFadeIn);
   		}
   	}
   	
   	iFadeIn = setInterval(FadeIn,5);
   }
   

the point is that this code simply doesnt seem to work… when i press the button (that aktivates the function) the mc starts fading and the pictures changes… with every click the pic changes again but keeps fading until alpha=0 … then nothing happens anymore… alpha doesnt raise or something… any ideas how to get this running?.. por any other solutions for my task?..

big thx in advance…

yours

EDIT:

btw… is there any better way to load all the pics to the array aBgPic?.. i’m sure there is one… i just dont know how to do it in AS… thx for any ideas…

ok… forget it folks… solved the problem

thx to kirupa’s great tutorials!!!