package com.exxon.slideshow.ui.slide { //import flash.display.DisplayObject; import flash.display.Loader; import flash.display.Sprite; import flash.events.Event; import flash.net.URLRequest; import com.exxon.slideshow.ui.nav.NumberButton; import com.mrmny.core.Dispatcher; import com.mrmny.core.FlashVars; import com.mrmny.core.events.StringEvent; /** * @author bill */ public class Slides extends Sprite { private var _loader:Loader; //private var _currentSlide:DisplayObject; //private var _nextSlide:DisplayObject; public function Slides() { _loader = new Loader(); addChild(_loader); _loader.contentLoaderInfo.addEventListener(Event.COMPLETE,_onSWFLoaded); Dispatcher.addEventListener(NumberButton.ON_LOAD_NEW_SLIDE, _onLoadeNewSlide); } private function _onSWFLoaded($e:Event):void{ trace("done!"); } private function _onLoadeNewSlide($n:StringEvent):void{ _loadSlide($n.getString()); } private function _loadSlide($url:String):void{ var urlr:URLRequest=new URLRequest(FlashVars.swfPath + $url); _loader.load(urlr); //TODO:add listener for for onloadcomplete // you could also have a progress listener if you need one and should a loader animation until load is complete } /* private function _onLoadComplete($e:Event):void{ // set next slide alpha to 0 // add next slide to stage at xhome and yhome that as defined in the _onLoadNewSlide function // if curent slide not null // fade down current slide // fade up next slide slide //once tween complete // remopve child current slide // set next slide to equal current slide } */ } }