This is surely not the most efficient way to do this, but it will get the job
done. If you plan on using something like this in several different
applications, it would probably be good to continue looking for better ways to
accomplish it, as I imagine this loop could be fairly harsh on the processor...
I would run tests to see how this affects other usage of your cf server to be
sure it doesn't adversely affect things.
At any rate, there is a function, GetTickCount which will show you the exact
number of milliseconds that have elapsed since your script started. Basically,
you can set up a loop to query that number until you reach the correct span:
<cfscript>
function Delay(delayMS) {
var tickCount1=GetTickCount();
var tickCount2=GetTickCount();
while (tickCount2 - tickCount1 lt delayMS) {
tickCount2=GetTickCount();
}
}
</cfscript>
Again, I have no idea what kind of impact this has on the processor, if any..
but it will go through that loop probably a hundred thousand times at least
before it falls out. I'd be curious to know what you find if you test it..
whether it runs smoothly with other cf requests or "blocks" everything while it
runs it's loop.
--
Pat
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:268662
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4