# Two times loadMovie?

**URL:** <https://forum.kirupa.com/t/two-times-loadmovie/298587>\
**Category:** flash\
**Created:** [October 21, 2009, 2:19pm UTC](https://forum.kirupa.com/t/two-times-loadmovie/298587 "2009-10-21T14:19:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![longneck](https://avatars.discourse-cdn.com/v4/letter/l/9f8e36/32.png) [@longneck](https://forum.kirupa.com/u/longneck)\
**Post date:** [October 21, 2009, 2:19pm UTC](https://forum.kirupa.com/t/two-times-loadmovie/298587/1 "2009-10-21T14:19:48Z")

</div>

Hi,

I’ve made this site:

[http://www.tetris.as/](http://www.tetris.as/)

Problem is that the pictures start to skip and are not being displayed for the full 3 seconds I want them to. The pics are loaded into an swf via AS and that swf is loaded into my main swf. When I test locally or use the direct path: [http://www.tetris.as/forside\_pix.swf](http://www.tetris.as/forside_pix.swf) it seems to work perfectly?

AS in main swf is:

_[COLOR=“RoyalBlue”]container.loadMovie(“hvem\_er\_vi2.swf”);  
loadMovieNum(“forside\_pix.swf”,1);  
stop();[/COLOR]_

AS in the loaded “pic-swf” is:

_[COLOR=“RoyalBlue”]import mx.transitions.Tween;  
import mx.transitions.easing._;

var imgNum = 6;  
var imgArray = [];

var imgDirectory = ‘forside/’;  
var imgName = ‘foto#.jpg’;

var hold:Number;  
var time:Number = 3000;

var mcl = new MovieClipLoader();  
var lstn = new Object();  
mcl.addListener(lstn);

function shuffleImages() {  
for(var i=1; i\<=imgNum; i++) { imgArray.push(i); }  
for(var ivar=imgArray.length-1; ivar\>=0; ivar–) {  
var pvar = Math.round(Math.random() \* (ivar+1));  
var tvar = imgArray[ivar];  
imgArray[ivar] = imgArray[pvar];  
imgArray[pvar] = tvar;  
}  
}

function loadImage() {  
if(imgArray.length == 0) shuffleImages();

```
var image = imgName.slice(0, imgName.indexOf('#')) + imgArray.shift() + imgName.substr(imgName.indexOf('#')+1);
var imgPath = imgDirectory+image;
lstn.onLoadInit = fadeIn;
mcl.loadClip(imgPath, container_mc);

```

}

function fadeIn() {  
var t = new Tween(container\_mc, ‘\_alpha’, Strong.easeOut, 0, 100, 1, true);  
t.onMotionFinished = function() {  
clearInterval(hold);  
hold = setInterval(fadeOut, time);  
}  
}

function fadeOut() {  
var t = new Tween(container\_mc, ‘\_alpha’, Strong.easeOut, 100, 0, 1, true);  
t.onMotionFinished = function() {  
loadImage();  
}  
}

loadImage();[/COLOR]\*

Any ideas on why the images are skiping would be greatly appreciated…

Thanks,  
Simon

PS: I can upload my swf’s or fla’s if that would help anyone to help me ;o)
