Indigo Rose Software
  #1  
Old 12-14-2006
holtgrewe holtgrewe is offline
Indigo Rose Customer
 
Join Date: Jul 2002
Location: Just South of Reality
Posts: 732
Example: Technique for Multiple timer events

Here is a technique I use for multiple timed events on a page. This is another example of how versatile AMS6 is in developing APs.

Code:
ON PRELOAD:
-- >>>>> setup timer invervals for firing multiple timed events.
-- >>>>> set up 6 timers 
myTimers_Max=6
-- >>>>> set up a duration for when each timer should be fired
myTimers_Duration={500,1000,1200,750,4000,2000}
-- >>>>> Set up an interval counter for each timer
myTimers_Interval={0,0,0,0,0,0}
Page.StartTimer(100); 
pgTimer_Counter=100


ON TIMER:
-- >>>>> increment the interval for each timer
for x = 1, myTimers_Max do
	myTimers_Interval[x] = myTimers_Interval[x] + pgTimer_Counter
end

-- >>>>> check if Individual timer event should be fired
for x = 1, myTimers_Max do
	if myTimers_Interval[x] >= myTimers_Duration[x] then
	    myTimers_Interval[x] = 0; --clear the interval counter & get ready for next time 
	    myTimer_Funct(x); -- execute the function for timer [x]
	end
end

--Global Function:
function myTimer_Funct(whichTimer)
if whichTimer == 1 then  -- Timer 1 has fired
	-- >>>>> timer1 scripting
end
--etc. for the other timers
Reply With Quote
  #2  
Old 07-21-2008
Imagine Programming's Avatar
Imagine Programming Imagine Programming is offline
Forum Member
 
Join Date: Apr 2007
Location: The Netherlands
Posts: 1,325
Nice example, thanks!
Reply With Quote
  #3  
Old 07-21-2008
Worm Worm is offline
Indigo Rose Customer
 
Join Date: Jul 2002
Location: USA
Posts: 3,937
I too have used a similar method, the only drawback is that if a certain timer interval has more than one function firing from it they are delayed while each function is processed. If you're not doing anything *heavy* within the function, it works great.
Reply With Quote
  #4  
Old 07-21-2008
ShadowUK ShadowUK is offline
Forum Member
 
Join Date: Oct 2007
Location: London, UK
Posts: 1,275
Woah at the two year bump. Nice method though.
Reply With Quote
  #5  
Old 08-07-2008
qwerty's Avatar
qwerty qwerty is offline
Forum Member
 
Join Date: Oct 2006
Posts: 345
Quote:
Originally Posted by ShadowUK View Post
Woah at the two year bump. Nice method though.


thats pretty impressive, and i thought i was bad for resurecting threads
Reply With Quote
  #6  
Old 08-07-2008
bule's Avatar
bule bule is offline
Indigo Rose Customer
 
Join Date: May 2005
Posts: 1,147
Well at least he is browsing the forum. Nothing wrong with the revival.
__________________
Never know what life is gonna throw at you.
(Based on a true story.)
Reply With Quote
  #7  
Old 08-07-2008
RizlaUK's Avatar
RizlaUK RizlaUK is offline
Forum Member
 
Join Date: May 2006
Location: London UK
Posts: 3,129
yup, remember the days when we only had 1 timer per page .. .. .. lmao
Reply With Quote
  #8  
Old 08-08-2008
Esfahan's Avatar
Esfahan Esfahan is offline
Forum Member
 
Join Date: Oct 2007
Location: كردي و من نتونستم جواب برات بفرستم
Posts: 233
Hello
oh, please attache a sample that how to use this codes ;;;
I can't use it
Reply With Quote
  #9  
Old 08-08-2008
RizlaUK's Avatar
RizlaUK RizlaUK is offline
Forum Member
 
Join Date: May 2006
Location: London UK
Posts: 3,129
Esfahan, the are easyer and more reliable timer methods on the forum, this is a pure ams workaround but its not ideal for heavy timer work

all the below timers solutions are bug free, reliable and vista compatable
http://www.indigorose.com/forums/sho...t=timer+plugin
http://www.indigorose.com/forums/sho...t=timer+plugin
http://www.indigorose.com/forums/sho...t=timer+plugin
Reply With Quote
  #10  
Old 08-08-2008
holtgrewe holtgrewe is offline
Indigo Rose Customer
 
Join Date: Jul 2002
Location: Just South of Reality
Posts: 732
sample

Esfahan
I've attached an example of something I did awhile ago. Keep in mind that this technique is fine as long as there is not a lot of extensive processing within the timer event, where the single timer can't keep up with the processing.
It does work; however I have personally switched to using one of the multiple timer options mentioned in the RizlaUK post.
Attached Files
File Type: apz tree.apz (324.7 KB, 98 views)
Reply With Quote
  #11  
Old 08-08-2008
Esfahan's Avatar
Esfahan Esfahan is offline
Forum Member
 
Join Date: Oct 2007
Location: كردي و من نتونستم جواب برات بفرستم
Posts: 233
@Rizla
THX , if AMS self have been a multi timer it be beter, but your plugin is very well
@holtgrewe
THX , I will check it
Reply With Quote
  #12  
Old 08-08-2008
RizlaUK's Avatar
RizlaUK RizlaUK is offline
Forum Member
 
Join Date: May 2006
Location: London UK
Posts: 3,129
personaly speaking, unless your project already uses luaCOM then i would use retesets timer plugin

Quote:
if AMS self have been a multi timer it be beter
yeah, maybe, but with all the timer options around i would rather see IR work on something that hasent been coverd by a plugin, there are many many things that AMS still lacks.
Reply With Quote
  #13  
Old 08-08-2008
qwerty's Avatar
qwerty qwerty is offline
Forum Member
 
Join Date: Oct 2006
Posts: 345
yes, they need to make use of the community... if the community finds a solution for something and it works well, then IR can spend more time working on things the community wants but cant be done from plugins etc (function selectable page transitions anyone ! ... improved security maybe ?)
Reply With Quote
  #14  
Old 08-08-2008
Esfahan's Avatar
Esfahan Esfahan is offline
Forum Member
 
Join Date: Oct 2007
Location: كردي و من نتونستم جواب برات بفرستم
Posts: 233
@Rizla
OK, Your luacom method same is a good plugin.

@holtgrewe
very very good project.
it is cool materiel for AMS multi timer without any plugin.
thanks for share your method.

too, it has a new idea for display timer actions.
Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Important method NOT included, Timer usernameCasper AutoPlay Media Studio 6.0 18 12-01-2006 12:21 PM
Example: Loading Paragraph Text Using a Timer Jonas DK AutoPlay Media Studio 5.0 Examples 7 11-25-2004 06:10 PM
Using Timer for Two or More Events patf AutoPlay Media Studio 5.0 4 07-26-2004 04:06 PM
Using Timer Events Desmond AutoPlay Media Studio 5.0 Examples 0 09-22-2003 03:14 PM
Here's an easy-to-use fully configurable general purpose Flash timer for your projects... Corey AutoPlay Media Studio 4.0 14 06-24-2003 05:21 AM


All times are GMT -6. The time now is 04:13 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software