Need help about Actionscript3 code

Hello there! I need to make a mini game for school in Actionscript 3. Everything seemed to go fine… till I needed a certain code x) I tried to search and search… but couldn’t find it anywhere :expressionless:

My problem:
I have a frame which loads random pictures of a certain folder. But I want the frame to last just a few seconds… like about 5 and then go to the next frame. And however I didn’t use a stop function… this frame still doesn’t go automatically to the next one.

I hope one of you know how to fix this problem… Thanks in advance :slight_smile:

My actionscript:

var imageArray:Array = new Array(10);
imageArray[0] = “Randomdoll/Outfit1.jpg”;
imageArray[1] = “Randomdoll/Outfit2.jpg”;
imageArray[2] = “Randomdoll/Outfit3.jpg”;
imageArray[3] = “Randomdoll/Outfit4.jpg”;
imageArray[4] = “Randomdoll/Outfit5.jpg”;
imageArray[5] = “Randomdoll/Outfit6.jpg”;
imageArray[6] = “Randomdoll/Outfit7.jpg”;
imageArray[7] = “Randomdoll/Outfit8.jpg”;
imageArray[8] = “Randomdoll/Outfit9.jpg”;
imageArray[9] = “Randomdoll/Outfit10.jpg”;

voegtoe();

function voegtoe(){
var plaatje:MovieClip = new mClip();
plaatje.x = 50;
plaatje.y = 100;
plaatje.img.source = imageArray[Math.round(Math.random()*(imageArray.length-1))];
addChild(plaatje);
}

You could try :


 
var WAIT_FRAME:int = 360 //6 seconds at 60 FPS 
var cpt:int = 0 ;
function Wait(pEvent:Event):void {
     if(cpt++ > WAIT_FRAME) {
          play(); //Or gotoAndPlay(), whatever
          removeEventListener(ENTER_FRAME, Wait);
     }
}
addEventListener(ENTER_FRAME, Wait);
stop();