View Single Post
Old 01-20-2012, 07:44 AM   PM User | #1
akuria
New Coder

 
Join Date: Nov 2011
Posts: 38
Thanks: 1
Thanked 0 Times in 0 Posts
akuria is an unknown quantity at this point
issue with slideshow in flex

i am trying to do a slideshow in flex and i am having issues with it. here is what i have so far in the code. i am using SDK 4.5 in flash builder.

Code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application 
	creationComplete="init()"
	xmlns:fx="http://ns.adobe.com/mxml/2009" 
	xmlns:s="library://ns.adobe.com/flex/spark" 
	xmlns:fc="http://ns.adobe.com/flashcatalyst/2009" 
	minWidth="546" 
	minHeight="362">
	
	<fx:Script>
		<![CDATA[
			import mx.effects.Fade;
			
			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);
				
				img.load("assets/"+pictures[0]);
				index ++;
				
				var timer:Timer = new Timer(5000);
				timer.addEventListener(TimerEvent.TIMER,changeImage);
				timer.start();
			}
			
			private function changeImage(e:TimerEvent):void{
				img.load("assets/"+pictures[index]);
				if(index<pictures.length -1) 
					index++;
				else 
					index=0;
			}
		]]>
	</fx:Script>
	
	<s:Image id="img" x="0" y="0" width="546" height="362"/>
	
</s:Application>
i am getting this error message:

1061: Call to a possibly undefined method load through a reference with static type spark.components:Image

the 2 lines i am getting this message are:

Code:
img.load("assets/"+pictures[0]);
img.load("assets/"+pictures[index]);
akuria is offline   Reply With Quote