-
swapping images in uiloader using code ?
I'm working in flash Cs4 and I just learned cash and I'm wondering if there's a way to use the Uiloader to load multiple images and have them change every couple of secondes like msn or actionvillage. This is my code so far:
next_btn.addEventListener(MouseEvent.CLICK, nextImage);
var imageNumber:Number = 1
function checkNumber():void
{
next_btn.visible=true;
back_btn.visible=true;
if(imageNumber>3){
trace(imageNumber);
//next_btn.visible = false;
imageNumber = 1;
}
}
function checkNum():void
{
if(imageNumber<1){
imageNumber = 3;
}
}
function nextImage (evtObj:MouseEvent):void
{
imageNumber++;
checkNumber();
largeImageLoader.source = "images/poster"+imageNumber+".png";
}
back_btn.addEventListener(MouseEvent.CLICK, backImage);
function backImage (evtObj:MouseEvent):void
{
imageNumber--;
checkNum();
largeImageLoader.source = "images/poster"+imageNumber+".png";
}
I have buttons below my uiloader that changes the images when you click on the manually but when you don't click on the arrows I would like the images to change automatically.
Any help would be appreciated, thank you.
-
Senior Member
var myInterval:uint = setInterval(changeImageFunction,5000);
Above runs the function every 5 secs. The following source has more on it.
http://www.republicofcode.com/tutori...s3setinterval/
-
-
THANK YOU! It really helped I have part of it working. Much thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|