Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Decommissioned > Flash Chat Project

 
 
Thread Tools Rate Thread Display Modes
Old 12-17-2003, 04:54 PM   #1
grindstonemedia
Registered User
 
Join Date: Dec 2003
Location: Africa
Posts: 12
Send a message via AIM to grindstonemedia
Default xml slideshow using setInterval with varriable time sequence...

aahhh okay here it is.....


the problem is that i cannot get setInterval to work with a varriable timer.....


here is the code:


ActionScript Code:
stop(); // create slideGlobals object to store global vars _global.slideGlobals = new Object(); // create and object to store all xml data slideShow = new Object(); // create time array inside slideShow object to store time slideShow.displayTime = new Array(); // create file name array inside slideShow object to store file name slideShow.fileName = new Array(); // build xml object mov_xml = new XML(); // fix scope issues with xml object... mov_xml._tl = this; mov_xml.onLoad = function(valid) {     if (!valid) {         trace("ERROR ____> xml data not loaded correctly, or data is invalid");     } else {         trace("SUCCESS____> xml loaded successfully");         // get the maximum amount of slides to be loaded         slideGlobals.maxSlides = this._tl.mov_xml.firstChild.childNodes.length;         for (i=0; i<slideGlobals.maxSlides; i++) {             this._tl.slideShow.displayTime.push(this.firstChild.childNodes[i].attributes.time);             this._tl.slideShow.fileName.push(this.firstChild.childNodes[i].attributes.url);         }         // create empty movie clip         this._tl.createEmptyMovieClip("slideMov", 10);     }     // start currentSlide var at zero     currentSlide = 0;     // create the loadMovie function     slideLoad = function () {         trace("slideLoad function called!");         if (currentSlide>=slideGlobals.maxSlides) {             clearInterval(slideInterval);             currentSlide = 0;             // load the movie into the slideMov             slideMov.loadMovie(slideShow.fileName[currentSlide]);             // set the interval as to wich movies should be loaded when             slideInterval = setInterval(slideLoad, slideShow.displayTime[currentSlide]*1000);         } else {             // load the movie into the slideMov             slideMov.loadMovie(slideShow.fileName[currentSlide]);             trace("current slide display time= "+slideShow.displayTime[currentSlide]);             trace("current slide= "+currentSlide);             clearInterval(slideInterval);             ++currentSlide;             // set the interval as to wich movies should be loaded when             slideInterval = setInterval(slideLoad, slideShow.displayTime[currentSlide]*1000);         }     };     //slideLoad();     // set the interval as to wich movies should be loaded when     slideInterval = setInterval(slideLoad, slideShow.displayTime[currentSlide]*1000); }; mov_xml.ignoreWhite = true; mov_xml.load("slideShow.xml");


the file "slideShow.xml" contains the following code:

<slideShow>
<slide url= "slideFilename.swf" time= "3"></slide>
<slide url= "slideFilename.swf" time= "1"></slide>
<slide url= "slideFilename.swf" time= "3"></slide>
<slide url= "slideFilename.swf" time= "4"></slide>
<slide url= "slideFilename.swf" time= "50"></slide>
<slide url= "slideFilename.swf" time= "50"></slide>
<slide url= "slideFilename.swf" time= "50"></slide>
<slide url= "slideFilename.swf" time= "50"></slide>
</slideShow>




so my question is simple.....


if you can understand this code and somehow know where i went wrong.. Please help because it would greatly be appriciated!


And for those of you who would like to help but can't be of any service maybe some suggestions would be considerd carefully....


If anyone knows alot about setInterval timer and how I could manipulate it so that it could work with varriable time please don't hessitate to reply to this post!!!


Of course this code is open source and may be used in your own personal projects... Please just give the appropriate credit to the people who deserve it where ever possible!!!



Please help....




Thank You

Grindstone Media

http://ww.grindstonemedia.co.za
grindstonemedia is offline  
Old 12-18-2003, 12:58 AM   #2
simonboris
HK510
 
simonboris's Avatar
 
Join Date: Nov 2001
Location: Montreal
Posts: 289
Default

try this

var jack=slideShow.displayTime[currentSlide]*1000;
slideInterval = setInterval(slideLoad, jack);
simonboris is offline  
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:16 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.