# Automatic Slideshow in AS 3.0 using Timer class and Array

**URL:** https://forum.kirupa.com/t/automatic-slideshow-in-as-3-0-using-timer-class-and-array/288122
**Category:** flash
**Created:** [May 11, 2009, 4:05pm UTC](https://forum.kirupa.com/t/automatic-slideshow-in-as-3-0-using-timer-class-and-array/288122 "2009-05-11T16:05:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![advertrix](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@advertrix](https://forum.kirupa.com/u/advertrix)
#### Post date: [May 11, 2009, 4:05pm UTC](https://forum.kirupa.com/t/automatic-slideshow-in-as-3-0-using-timer-class-and-array/288122/1 "2009-05-11T16:05:20Z")

</div>

Hey guys,

i am new to AS 3.0 and still trying to grasp the new concept of oop. I have been trying to create an automatic slideshow at a click of a button. I have tried a few ways using timer class to show images(stored in an array) for a few seconds but i can’t seem to get it working. Below is the code that i am trying to get it working…if there is any kind soul out there, please help me…

// Store picture names in an array  
var vPicLoader:Array = [“pix1.jpg”,“pix2.jpg”,“pix3.jpg”];

var myTimer:Timer = new Timer(2000);  
myTimer.addEventListener(TimerEvent.TIMER, timerListener);

function timerListener (e:TimerEvent):void{

var picNum:Number = 0;  
compUILoader.source = vPicLoader[picNum];  
}

function onStartSlideShow(e:MouseEvent):void{  
myTimer.start();  
}

// make the button call the function to start the slideshow  
slideshow\_btn.addEventListener(MouseEvent.CLICK, onStartSlideshow);
