OK so it has been asked a lot so here it is. An easy to use timer (Flash v5). You can set how fast it loops (anywhere from 10 loops per second to ten seconds per loop) and how many times it loops (use zero for no limit). It returns fscommands (contains current loop number) on each loop completion and again on finish. Very easy to use, readme file (as pasted below) and sample file are included in the download as well as the original timer Macromedia Flash source file. It's super easy to use this timer and it's reasonably accurate. Also because it uses frame cycling to generate pauses rather than a WHILE or DO loop, it will not slow down your applications. Have fun, if you have any questions feel free to ask... Also feel free to use any of the code in this .zip file in any of your projects.
http://www.indigorose.com/temp_web/timer.zip
Contents of readme.txt:
FLASH TIMER READ ME FILE - INDIGO ROSE SOFTWARE 2003
by Corey Milner - Creative Director Indigo Rose Software.
Hi everyone, here's an easy-to-use timer you can use within your AutoPlay Media Studio projects to time things or trigger events, etc. The timer requires two pieces of info to run, a loop rate and a loop limit. This allows you to specify how long each loop takes and how many loops occur. The timer returns 2 pieces of info to AMS via fscommands, it sends the loop iteration number, i.e. "10" at the end of each loop and then it sends a "done" message after the last loop. You can use these events to trigger anything you want. OK so let's take a look at how to use it (sample file is included, open it up in AMS and check it out, it's very easy to understand).
1. Drop the file timer.swf into your project's "Resources" folder.
2. Create a new Flash Object on your page, point it to the file timer.swf (change background color if need be, timer is 1 X 1 pixels white)
3. Decide how fast you want the timer to loop. The options allow you to specify any number between .1 and 10 , the number being "How many seconds per loop". So if you want it to loop once per second you would use 1, if you want it to loop once every 5 seconds you would use 5, etc.
4. Decide how many loops you want the timer to make before ending. This can be any non-negative number, If you wish it to loop forever use a zero.
5. OK now that we have our timer inserted and we know our stats we'll insert the values. Just use a FLASH OBJECT > SET VARIABLE action to set timer.swf's Flash variable "loopRate" to whatever number you chose in step 3 then use another FLASH OBJECT > SET VARIABLE action to set timer .swf's Flash variable "loopLimit" to whatever number you chose in step 4 above.
6. To be safe insert a FLASH OBJECT > SEEK action and set it to go to frame zero, then insert a FLASH OBJECT > PLAY action. That's it, your timer is working.
To retrieve info from your timer
1. The timer itself transmits an fscommand containing the current loop number at the end of each loop, i.e. 1, 2, 3, etc... To use this info to trigger actions go to your timer.swf's Flash Object properties and add a FLASH OBJECT > GET PROPERTY > LAST FSCOMMAND action to the OnFSCommand event, this will read the last fscommand transmitted into a variable which you can then test with an IF statement to trigger anything you like, i.e. "IF loop = 5 then start video", etc...
2. The timer also transmits the fscommand "done" when all the loops have been completed. Use the same technique above to retrieve this into a variable for testing, etc.
A couple final notes. This timer is not completely accurate in terms of time and timing will vary slightly from fast systems to slow systems, but overall it's pertty reliable and because it uses a frame cycling as a timer methodology rather than a WHILE or DO loop, it chews up no resources at all while it's running in the background of your AMS application page. NOTE I tried many different techniques, even using microtime, etc. but this frame cycling method was the only one I found which was reasonably accurate and could fire many times per second without slowing down your application)
Hope you guys enjoy using this, if there's any questions just post them in the user forum at www.indigorose.com. TTYL. [img]/ubbthreads/images/icons/smile.gif[/img]
Corey Milner - Creative Director Indigo Rose Software.
AutoPlay Media Studio is a registered trademark of Indigo Rose Software, all rights reserved. This training material copyright 2003 Indigo Rose Software, feel free to share it with friends but please keep this readme and all included files intact and unaltered in all distributed copies.
Corey Milner
Creative Director, Indigo Rose Software
http://www.indigorose.com/temp_web/timer.zip
Contents of readme.txt:
FLASH TIMER READ ME FILE - INDIGO ROSE SOFTWARE 2003
by Corey Milner - Creative Director Indigo Rose Software.
Hi everyone, here's an easy-to-use timer you can use within your AutoPlay Media Studio projects to time things or trigger events, etc. The timer requires two pieces of info to run, a loop rate and a loop limit. This allows you to specify how long each loop takes and how many loops occur. The timer returns 2 pieces of info to AMS via fscommands, it sends the loop iteration number, i.e. "10" at the end of each loop and then it sends a "done" message after the last loop. You can use these events to trigger anything you want. OK so let's take a look at how to use it (sample file is included, open it up in AMS and check it out, it's very easy to understand).
1. Drop the file timer.swf into your project's "Resources" folder.
2. Create a new Flash Object on your page, point it to the file timer.swf (change background color if need be, timer is 1 X 1 pixels white)
3. Decide how fast you want the timer to loop. The options allow you to specify any number between .1 and 10 , the number being "How many seconds per loop". So if you want it to loop once per second you would use 1, if you want it to loop once every 5 seconds you would use 5, etc.
4. Decide how many loops you want the timer to make before ending. This can be any non-negative number, If you wish it to loop forever use a zero.
5. OK now that we have our timer inserted and we know our stats we'll insert the values. Just use a FLASH OBJECT > SET VARIABLE action to set timer.swf's Flash variable "loopRate" to whatever number you chose in step 3 then use another FLASH OBJECT > SET VARIABLE action to set timer .swf's Flash variable "loopLimit" to whatever number you chose in step 4 above.
6. To be safe insert a FLASH OBJECT > SEEK action and set it to go to frame zero, then insert a FLASH OBJECT > PLAY action. That's it, your timer is working.
To retrieve info from your timer
1. The timer itself transmits an fscommand containing the current loop number at the end of each loop, i.e. 1, 2, 3, etc... To use this info to trigger actions go to your timer.swf's Flash Object properties and add a FLASH OBJECT > GET PROPERTY > LAST FSCOMMAND action to the OnFSCommand event, this will read the last fscommand transmitted into a variable which you can then test with an IF statement to trigger anything you like, i.e. "IF loop = 5 then start video", etc...
2. The timer also transmits the fscommand "done" when all the loops have been completed. Use the same technique above to retrieve this into a variable for testing, etc.
A couple final notes. This timer is not completely accurate in terms of time and timing will vary slightly from fast systems to slow systems, but overall it's pertty reliable and because it uses a frame cycling as a timer methodology rather than a WHILE or DO loop, it chews up no resources at all while it's running in the background of your AMS application page. NOTE I tried many different techniques, even using microtime, etc. but this frame cycling method was the only one I found which was reasonably accurate and could fire many times per second without slowing down your application)
Hope you guys enjoy using this, if there's any questions just post them in the user forum at www.indigorose.com. TTYL. [img]/ubbthreads/images/icons/smile.gif[/img]
Corey Milner - Creative Director Indigo Rose Software.
AutoPlay Media Studio is a registered trademark of Indigo Rose Software, all rights reserved. This training material copyright 2003 Indigo Rose Software, feel free to share it with friends but please keep this readme and all included files intact and unaltered in all distributed copies.
Corey Milner
Creative Director, Indigo Rose Software
Comment