Learn, Please post finished code. -KF [quoted text, click to view] "Learn" <webforumsuser@macromedia.com> wrote in message news:crc2ib$kmu$1@forums.macromedia.com... > Got the answer!!! > > Very simple, just used a counter from the parent movie clip that supplied variable value the XML movie clip. > > Learn... > Nothing is impossible......
Hi all, My problem is not loading data from an XML file but loading a new childNode every 20 seconds. What i have at the moment is as included in the code. Function loadNextSlide() loads all the data in one go and finishes with the last child's data displayed, but i want it to wait for 20 seconds before it loads the 2nd childnode, then another 20 secs before the 3rd and so on. If someone has a solution or has any idea of how i can do this please let me know, Gratefully, Learn...... Nothing's impossible!! --------------------Code------------------ slides_xml = new XML(); slides_xml.onLoad = startSlideShow; slides_xml.load("Portfolio/slides.xml"); slides_xml.ignoreWhite = true; // // Show the first slide and intialize variables function startSlideShow(success) { if (success == true) { rootNode = slides_xml.firstChild; _global.totalSlides = rootNode.childNodes.length; firstSlideNode = rootNode.firstChild; loadNextSlide(firstSlideNode); } } function loadNextSlide(firstSlideNode) { for( var i:Number = 0; i <= totalSlides; i++) { if (i == 1) {updateSlide(firstSlideNode);} if ((i > 1))//&& (TimeResult >= 20)) { nextSlideNode = firstSlideNode.nextSibling; if (nextSlideNode == null) { break; } else { //i++; updateSlide(nextSlideNode); firstSlideNode = nextSlideNode; } } } } // Updates the current slide with new image and text function updateSlide(currentSlideNode) { imagePath = currentSlideNode.attributes.jpegURL; description = currentSlideNode.attributes.description; client = currentSlideNode.attributes.client; technology = currentSlideNode.attributes.technology; loadMovie(imagePath, targetClip); }
Got the answer!!! Very simple, just used a counter from the parent movie clip that supplied variable value the XML movie clip. Learn...
Hey!! I decided to use an alternative solution. i initialised a counter in the main timeline and increased it everytime the tween on the main timeline had finished playing. frame 1: var Count = 1; frame 2: Start Tween; frame 150: FINISH TWEEN, CODE FOR THE FRAME: if (Count < totalSlides) {Count++;} else if (Count == totalSlides) { Count =1;} gotoAndPlay(2); i than used the value for "Count" in my xml movie to display the next childNode. Not what i posted the question for but it provides the functionality i needed. Hope this is OK, Learn... Nothing is Impossible.....
Note that you can always use the getTimer() function to get the time in milliseconds from the start of the SWF, to actually time something, instead of counting frames And you also could use the Date class to get the current system time.
Don't see what you're looking for? Try a search.
|