Hi again,
Sorry about that.. I've forgotten how Flex's image control works (that and I wasn't at a FLEX machine before
Try something like this: (NOTE: I used the mx version of 'Image' and I make use out of FLEX's data Binding with the imageSource variable
this worked for me when I tested it, give it a shot.
Code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:fc="http://ns.adobe.com/flashcatalyst/2009"
creationComplete="init()"
minWidth="955" minHeight="600">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.effects.Fade;
[Bindable]
private var imageSource:String = "";
private var pictures : Array = ["venue1.jpg","venue2.jpg","venue3.jpg","venue4.jpg"];
private var index:int = 0;
private function init():void{
img.setStyle("completeEffect",Fade);
imageSource = 'assets/' + pictures[index++];
var timer:Timer = new Timer(5000);
timer.addEventListener(TimerEvent.TIMER,changeImage);
timer.start();
}
private function changeImage(e:TimerEvent):void{
imageSource = ("assets/"+pictures[index++]);
if(index>pictures.length -1)
index=0;
}
]]>
</fx:Script>
<mx:Image source="{imageSource}" id="img" x="0" y="0" width="546" height="362"/>
</s:Application>