<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Power-up Media Blog &#187; timeout</title>
	<atom:link href="http://blog.powerupmedia.nl/tag/timeout/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.powerupmedia.nl</link>
	<description></description>
	<lastBuildDate>Wed, 20 Jul 2011 20:39:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>Joy with the script timeout period</title>
		<link>http://blog.powerupmedia.nl/2007/08/24/joy-with-the-script-timeout-period/</link>
		<comments>http://blog.powerupmedia.nl/2007/08/24/joy-with-the-script-timeout-period/#comments</comments>
		<pubDate>Fri, 24 Aug 2007 12:11:28 +0000</pubDate>
		<dc:creator>Arno van Oordt</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Power-up Media]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[timeout]]></category>

		<guid isPermaLink="false">http://blog.justgreat.nl/?p=60</guid>
		<description><![CDATA[Isn&#8217;t it just great when you finally find a useful new feature in Flash 9. I&#8217;m talking about the script-timeout period. Remember how you sometimes had to run a script for more than 15 seconds and always got that annoying timeout popup? From now on (using Flash 9 / player 7 and up) you can [...]]]></description>
			<content:encoded><![CDATA[<p>Isn&#8217;t it just great when you finally find a <strong>useful</strong> new feature in Flash 9.<br />
I&#8217;m talking about the script-timeout period.<br />
Remember how you sometimes had to run a script for more than 15 seconds and always got that annoying timeout popup? From now on (using Flash 9 / player 7 and up) you can set the timeout as you wish. Isn&#8217;t that just great?!<br />
It gets even better when you use AS3; the player doesn&#8217;t just show the script-timeout popup but it actually throws an Error (&#8220;Error #1502: A script has executed for longer than the default timeout period of 15 seconds.&#8221;). This way you can make a certain part of your script (which needs more time than the supplied timeout period) run over and over again until the calculation is complete.</p>
<p>Here is an example:</p>

<div class="wp_codebox"><table><tr id="p602"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code" id="p60code2"><pre class="actionscript" style="font-family:monospace;">package <span style="color: #66cc66;">&#123;</span> 
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>; 
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>; 
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TestMC <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span><span style="color: #66cc66;">&#123;</span> 
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; 
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> loopCount:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; 
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> TestMC<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> 
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span>, <span style="color: #0066CC;">this</span>.<span style="color: #006600;">calculate</span><span style="color: #66cc66;">&#41;</span>; 
		<span style="color: #66cc66;">&#125;</span> 
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> calculate<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span> 
			<span style="color: #0066CC;">try</span><span style="color: #66cc66;">&#123;</span> 
				<span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> <span style="color: #0066CC;">this</span>.<span style="color: #006600;">i</span>++; <span style="color: #66cc66;">&#125;</span> 
			<span style="color: #66cc66;">&#125;</span> 
			<span style="color: #0066CC;">catch</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:<span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> 
				<span style="color: #0066CC;">this</span>.<span style="color: #006600;">loopCount</span>++; 
				<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;____________n'i' after &quot;</span>+loopCount+<span style="color: #ff0000;">&quot; frames = &quot;</span> + <span style="color: #0066CC;">this</span>.<span style="color: #006600;">i</span><span style="color: #66cc66;">&#41;</span>; 
				<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&amp;</span>lt;<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">//i will be negative when it becomes to big, normally you would check here if your calculation is done... </span>
					<span style="color: #0066CC;">this</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span>, <span style="color: #0066CC;">this</span>.<span style="color: #006600;">calculate</span><span style="color: #66cc66;">&#41;</span>; 
				<span style="color: #66cc66;">&#125;</span> 
			<span style="color: #66cc66;">&#125;</span> 
		<span style="color: #66cc66;">&#125;</span> 
	<span style="color: #66cc66;">&#125;</span> 
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>This is just an example and I’m sure you can think of much more useful ways to use this feature.<br />
Hope it heps you along…</p>
<p>Update (1 December 2007):<br />
Just great; I forgot to mention HOW to set the timeout . Well here is how:<br />
You can’t set the timeoutperiod by code (neither in as3 nor in as2). You have to set the timeout manually in the publish settings of your fla: Ctrl+Shift+F12 &gt; flash-tab &gt; “Script time limit”.<br />
Let me know if you still have trouble.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.powerupmedia.nl/2007/08/24/joy-with-the-script-timeout-period/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

