Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-28-2012, 01:30 AM   #11
Registered User
Join Date: May 2012
Posts: 19

Oh and set to 0 in the public declaration
fortrium is offline   Reply With Quote
Old 05-28-2012, 01:45 AM   #12
Senior Member
Join Date: Aug 2010
Location: Sydney,Australia
Posts: 132

ActionScript Code:
//Lets say menuXML.gallery has 10 items var i = 0 ; for each (var  item in menuXML.gallery.imageFile){        //i goes from 0 - 9 here !!     newSlide();     //i gets incremented here . Remember the last value of i is not 9 but 10 because it is incremented and this is the value that gets fed in when the timer completes     i++;            //->>>>>>>>>>>>>>>>>>>>>>>>>>>OUT OF THE LOOP     tenSecondTimer.addEventListener(TimerEvent.TIMER, unWait);          //Doesnt matter where you define this function . it will always be called after 10 seconds .If fps is 32 it wil be called after 320 frames.     //Doesnt matter how many items you have in the imageFile when unwait is called i is always 10 unless u have reset it     //OOPS imageFile[10] doesnt exist     //You just defined a function umm 10 times? but why?     function unWait(evt:TimerEvent){newSlide();}            //Fails!!!!!     tenSecondTimer.start();     //->>>>>>>>>>>>>>>>>>>>>>>>>>OUT OF THE LOOP     }//While we got nodes

Alright here is my explanation of your code. May be you might have to rethink your logic a little bit.

p.s try not nesting functions. it is easier to debug that way

Last edited by Sonny; 05-28-2012 at 01:47 AM.
Sonny is offline   Reply With Quote
Old 05-28-2012, 02:15 AM   #13
Join Date: Sep 2006
Location: Toronto,Canada
Posts: 127

Originally Posted by fortrium View Post
Yes I do want a delay between slides, but right now what's happening is the For Each loop never waits before getting the next image.

remove your for each loop ah everything what is inside loop

ActionScript Code:
on very end add two rows
ActionScript Code:
i++ if(i>=menuXML.gallery.imageFile.length) i=0; setTimeout(newSlide,10000);

instead of for each loop put :
ActionScript Code:

Last edited by uplight; 05-28-2012 at 02:17 AM.
uplight is offline   Reply With Quote

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 On
HTML code is Off

Forum Jump

All times are GMT. The time now is 01:35 AM.

Follow actionscriptorg on Twitter


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