<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="490" height="500" backgroundColor="#000000" frameRate="99" layout="absolute" xmlns:display="com.visualempathy.display.*" creationComplete="init()" paddingBottom="5" paddingLeft="5" paddingRight="5" paddingTop="5" viewSourceURL="srcview/index.html"> <mx:Script> <![CDATA[ import mx.events.CollectionEvent; private var current:int = 0; private var images:Array = ['http://www.visualempathy.com/ssp_director/albums/album-152/lg/favorites13.jpg', 'http://www.visualempathy.com/ssp_director/albums/album-152/lg/favorites17.jpg', 'http://www.visualempathy.com/ssp_director/albums/album-152/lg/favorites20.jpg', 'http://www.visualempathy.com/ssp_director/albums/album-152/lg/favorites27.jpg', 'http://www.visualempathy.com/ssp_director/albums/album-152/lg/favorites29.jpg'] public function init():void { this.swap.changeImage(this.images[0]) } public function swapImages():void { this.loadBtn.label = 'loading...' this.loadBtn.enabled = false; if(this.current==images.length-1) { this.swap.changeImage(this.images[0]); this.current = 0; } else { this.swap.changeImage(this.images[this.current+1]); this.current += 1; } } public function handleLoaded():void { this.loadBtn.enabled=true; this.loadBtn.label = 'load next'; } ]]> </mx:Script> <display:ImageSwap id="swap" imageLoaded="handleLoaded()"/> <mx:HBox width="100%" horizontalAlign="center" paddingBottom="5" paddingLeft="5" paddingRight="5" paddingTop="5"> <mx:Button id="loadBtn" enabled="false" label="load next" click="swapImages()" fillAlphas="[1.0, 1.0]" fillColors="[#FFFFFF, #FFFFFF]" color="#000000" fontFamily="Arial"/> </mx:HBox> </mx:Application>