View Single Post
Old 01-21-2012, 12:41 PM   PM User | #4
adaminaudio
New Coder

 
Join Date: Jan 2012
Location: Columbus, Ohio, U.S.A
Posts: 41
Thanks: 0
Thanked 8 Times in 8 Posts
adaminaudio is an unknown quantity at this point
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>

Last edited by adaminaudio; 01-21-2012 at 12:55 PM..
adaminaudio is offline   Reply With Quote
Users who have thanked adaminaudio for this post:
akuria (01-24-2012)