tags:

views:

15

answers:

0

I am trying to switch which movie clip is loaded for the nextClick dynamically. I am pulling the list from an XML file. What I really what to achieve is for the user to click the next button and the number changes to the next swf number, using the total number of available swfs from the XML file. The same would apply for my previous button.

Ideally it would switch the number in this element: "+slideNumArray[1]+"

//Code//

//Slide Array var slideArray:Array = new Array(); var slideNumArray:Array = new Array();

//XML //Load in XML var XMLURLLoader:URLLoader = new URLLoader(); XMLURLLoader.load(new URLRequest("slides.xml")); XMLURLLoader.addEventListener(Event.COMPLETE, processXML);

function processXML(event:Event):void { var theXMLData:XML=new XML(XMLURLLoader.data); for (var i:Number = 0; i < theXMLData.slide.length(); i++) { trace("length:" + theXMLData.slide.length()); slideArray.push(theXMLData.slide[i]); slideNumArray.push(theXMLData.slideNum[i]); } }

//TELLS FLASH TO IMPORT THE APPROPRIATE CODE import fl.transitions.Tween; import fl.transitions.easing.*;

//LISTEN FOR THE CLICK OF THE BUTTONS

function moveContent(theAlpha:Number,theSlide:String):void { for (var i:Number = 0; i < slideNumArray[i]; i++) {

trace("Alpha: "+theAlpha); trace("Slide: "+slideNumArray); var myTweenAlpha:Tween=new Tween(slideLoader,"alpha",Strong.easeOut,0,1,theAlpha,true); slideLoader.source=theSlide; } }

btnNext.addEventListener(MouseEvent.CLICK, nextClick); function nextClick(e:MouseEvent):void { trace("nextClick"); moveContent(2, "slides/slide" +slideNumArray[1]+".swf"); }