<?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>Mark Ledford&#039;s Blog &#187; actionscript</title>
	<atom:link href="http://www.markledford.com/blog/tag/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markledford.com/blog</link>
	<description>Documenting the pitfalls of a Flash platform developer</description>
	<lastBuildDate>Thu, 24 Jun 2010 14:49:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>flash player 10 security change can break focus logic with cross domain swfs</title>
		<link>http://www.markledford.com/blog/2009/08/28/flash-player-10-security-change-can-break-focus-logic-with-cross-domain-swfs/</link>
		<comments>http://www.markledford.com/blog/2009/08/28/flash-player-10-security-change-can-break-focus-logic-with-cross-domain-swfs/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 06:22:48 +0000</pubDate>
		<dc:creator>markledford</dc:creator>
				<category><![CDATA[flex]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.markledford.com/blog/?p=70</guid>
		<description><![CDATA[With the barrage of player updates and security changes to the Flash Player staying on top of the issues and incompatibilities from player to player is sometimes as troublesome as cross browser compatibility for regular web development. This is especially true for the upgrade from Flash Player 9 to 10. There were some well publicized [...]]]></description>
			<content:encoded><![CDATA[<p>With the barrage of player updates and security changes to the Flash Player staying on top of the issues and incompatibilities from player to player is sometimes as troublesome as cross browser compatibility for regular web development. This is especially true for the upgrade from Flash Player 9 to 10.</p>
<p>There were some well publicized major security changes for <a href="http://www.adobe.com/devnet/flashplayer/articles/fplayer10_security_changes_02.html#head1">policy files</a> and the <a href="http://www.adobe.com/devnet/flashplayer/articles/fplayer10_security_changes_02.html#head3" target="_blank">filereference</a> class included with the Flash Player 10 security updates but a seemingly less significant new restriction regarding cross domain swf focus can wreak havoc on an existing flash project . The new restriction is outlined here:<br />
<a href="http://www.adobe.com/devnet/flashplayer/articles/fplayer10_security_changes_02.html#head33" target="_blank">Related-object properties in events may not be available</a></p>
<blockquote><p>Starting in Flash Player 10.0.2, if an object that would be referred to by any of these properties [MouseEvent.relatedObject, FocusEvent.relatedObject, ContextMenuEVent.mouseTarget] resides in a different security sandbox (for example, because it is part of a different SWF that was served from a different domain), and the two sandboxes do not both trust each other (by means of the Security.allowDomain method), then the value of this property is changed to null.</p></blockquote>
<p>I&#8217;ve found this is a significant change for cross domain swfs that utilize any of Flash&#8217;s V3 Components. Some 3rd party crossdomain swfs that once worked fine will no longer focus properly when clicking on textfields. Digging into this component architecture&#8217;s FocusManger you can find the culprit:</p>
<p>fl.managers.FocusManager::mouseFocusChangeHandler(event:FocusEvent)</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">/**<br />
*  @private<br />
*  This gets called when mouse clicks on a focusable object.<br />
*  We block Flash Player behavior.<br />
*<br />
* @langversion 3.0<br />
* @playerversion Flash 9.0.28.0<br />
*/</span><br />
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> mouseFocusChangeHandler<span style="color: #66cc66;">&#40;</span>event:FocusEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">relatedObject</span> is <span style="color: #0066CC;">TextField</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">//&lt;- related object will always be null </span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span>; <span style="color: #808080; font-style: italic;">// pass it on</span><br />
&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp;event.<span style="color: #006600;">preventDefault</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>The solution is to add a Security.allowDomain(&#8220;YourDomain&#8221;) if you have access to republish, otherwise you&#8217;d have to use a proxy server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markledford.com/blog/2009/08/28/flash-player-10-security-change-can-break-focus-logic-with-cross-domain-swfs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Multipart form data in flash</title>
		<link>http://www.markledford.com/blog/2009/02/20/multipart-form-data-in-flash/</link>
		<comments>http://www.markledford.com/blog/2009/02/20/multipart-form-data-in-flash/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 23:39:27 +0000</pubDate>
		<dc:creator>markledford</dc:creator>
				<category><![CDATA[flex]]></category>
		<category><![CDATA[actionscript]]></category>

		<guid isPermaLink="false">http://www.markledford.com/blog/2009/02/20/multipart-form-data-in-flash/</guid>
		<description><![CDATA[Eugene has a handy MultipartURLLoader class to do the leg work of sending multipart form data from flash. Note that because it uses: urlRequest.requestHeaders.push( new URLRequestHeader( &#8216;Cache-Control&#8217;, &#8216;no-cache&#8217; ) ); You may get SecurityError: Error #2044: Unhandled securityError:. text=Error #2170: Security sandbox violation: http://domain1.com/your.swf cannot send HTTP headers to http://domain2.com/yourscript.php. You may need to add [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.inspirit.ru/?p=139" target="_blank">Eugene has a handy MultipartURLLoader class</a> to do the leg work of sending multipart form data from flash.</p>
<p>Note that because it uses:<br />
urlRequest.requestHeaders.push( new URLRequestHeader( &#8216;Cache-Control&#8217;, &#8216;no-cache&#8217; ) );</p>
<p>You may get SecurityError:<br />
Error #2044: Unhandled securityError:. text=Error #2170: Security sandbox violation: http://domain1.com/your.swf cannot send HTTP headers to http://domain2.com/yourscript.php.</p>
<p>You may need to add a variation of &lt;allow-http-request-headers-from domain=&#8221;*&#8221; headers=&#8221;*&#8221;/&gt;  to your crossdomain.xml file or comment out that line. I chose the latter as I don&#8217;t think its neccessary in a POST call.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markledford.com/blog/2009/02/20/multipart-form-data-in-flash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>solved: white rectangular flicker occuring when clicking on buttons in as3 project</title>
		<link>http://www.markledford.com/blog/2009/02/13/solved-white-rectangular-flicker-occuring-when-clicking-on-buttons-in-as3-project/</link>
		<comments>http://www.markledford.com/blog/2009/02/13/solved-white-rectangular-flicker-occuring-when-clicking-on-buttons-in-as3-project/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 07:26:06 +0000</pubDate>
		<dc:creator>markledford</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://www.markledford.com/blog/?p=47</guid>
		<description><![CDATA[Thanks be to Google and this blog I finally tracked down the cause of a mysterious unsightly rectangular white flicker that occurs when clicking on buttons in some of my projects as of late.  The culprit? Mac Firefox 3 + SWFAddress. Its really an ExternalInterface+Firefox 3 issue but a recent SWFAddress 2.2 release fixes it! [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks be to Google and <a href="http://www.blog.lessrain.com/possible-bug-in-firefox-301-mac/">this blog</a> I finally tracked down the cause of a mysterious unsightly rectangular white flicker that occurs when clicking on buttons in some of my projects as of late.  The culprit? Mac Firefox 3 + SWFAddress. Its really an ExternalInterface+Firefox 3 issue but a recent SWFAddress 2.2 release fixes it!</p>
<p>-Build-in fix for the Firefox 3/Mac OSX blinking effect.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markledford.com/blog/2009/02/13/solved-white-rectangular-flicker-occuring-when-clicking-on-buttons-in-as3-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>javascript injection in AS3</title>
		<link>http://www.markledford.com/blog/2009/01/20/javascript-injection-in-as3/</link>
		<comments>http://www.markledford.com/blog/2009/01/20/javascript-injection-in-as3/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 02:13:07 +0000</pubDate>
		<dc:creator>markledford</dc:creator>
				<category><![CDATA[flex]]></category>
		<category><![CDATA[actionscript]]></category>

		<guid isPermaLink="false">http://www.markledford.com/blog/?p=32</guid>
		<description><![CDATA[Pretty useful method of storing Javascript inside of a swf for use with ExternalInterface. The novel part is maintaining the formatted Javascript inside of an xml object, check it out here. Thanks to Derek for the link.]]></description>
			<content:encoded><![CDATA[<p>Pretty useful method of storing Javascript inside of a swf for use with ExternalInterface. The novel part is maintaining the formatted Javascript inside of an xml object, check it out <a href="http://www.actionscript.org/resources/articles/745/4/JavaScript-and-VBScript-Injection-in-ActionScript-3/Page4.html" target="_blank">here</a>. Thanks to <a href="http://flexonrails.net/" target="_blank">Derek</a> for the link.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markledford.com/blog/2009/01/20/javascript-injection-in-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>encodeURIComponent in AS3</title>
		<link>http://www.markledford.com/blog/2008/12/17/encodeuricomponent-in-as3/</link>
		<comments>http://www.markledford.com/blog/2008/12/17/encodeuricomponent-in-as3/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 23:20:05 +0000</pubDate>
		<dc:creator>markledford</dc:creator>
				<category><![CDATA[actionscript]]></category>

		<guid isPermaLink="false">http://www.markledford.com/blog/?p=27</guid>
		<description><![CDATA[Haven&#8217;t posted in awhile. Been Keeping busy here at KickApps and took a 2 week vacation to South Korea. It was awesome :) I was looking into interfacing with some Facebook APIs today via actionscript and was having some issues passing some nested querystring vars. Turned out using escape() wasn&#8217;t enough and encodeURIComponent() did the [...]]]></description>
			<content:encoded><![CDATA[<p>Haven&#8217;t posted in awhile. Been Keeping busy here at KickApps and took a 2 week vacation to South Korea. It was awesome :)</p>
<p>I was looking into interfacing with some Facebook APIs today via actionscript and was having some issues passing some nested querystring vars. Turned out using escape() wasn&#8217;t enough and encodeURIComponent() did the trick. I didn&#8217;t realize it was even available in actionscript until i did some googling. encodeURI() and encodeURIComponent() are available along with escape() as top level functions in AS3.</p>
<p><a href="http://xkr.us/articles/javascript/encode-compare/">Here&#8217;s a useful link explaining the difference</a> between them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markledford.com/blog/2008/12/17/encodeuricomponent-in-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysterious “Where is the debugger or host application running?” dialogue on non-debug swfs</title>
		<link>http://www.markledford.com/blog/2008/09/01/mysterious-where-is-the-debugger-or-host-application-running-dialogue-on-non-debug-swfs/</link>
		<comments>http://www.markledford.com/blog/2008/09/01/mysterious-where-is-the-debugger-or-host-application-running-dialogue-on-non-debug-swfs/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 06:49:40 +0000</pubDate>
		<dc:creator>markledford</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.markledford.com/blog/?p=22</guid>
		<description><![CDATA[Remember awhile back when you&#8217;d go to a flash site and randomly get accosted by a “Where is the debugger or host application running?” modal prompt? Haven&#8217;t seen one in a while have you? Happily these days debug swfs normally don&#8217;t pop open this dialogue unless you explicitly right click a debug swf and click [...]]]></description>
			<content:encoded><![CDATA[<p>Remember awhile back when you&#8217;d go to a flash site and randomly get accosted by a “Where is the debugger or host application running?” modal prompt? Haven&#8217;t seen one in a while have you? Happily these days debug swfs normally don&#8217;t pop open this dialogue unless you explicitly right click a debug swf and click on &#8220;Debugger&#8221; from its context menu. Unfortunely there are still some tricky situations where this prompt will still rear its ugly head.</p>
<p>My Google-foo (or Adobe?) has let me down on getting solid information on this but in my tests it appears this functionality changed with Flash Player Debugger 9,0,115,0 (Yeah, I thought it was earlier too). This is the debugger version that installs with Flex so even tho you may no longer get the prompt its keen to note that any viewer with a &lt;9,0,115,0 Flash 9 debugger (like the 9,0,45,0 debugger that installs with Adobe CS3) will still receive it. In most cases this isn&#8217;t anything to worry about though as its second nature to turn off debugging on your production swf. However did you know you have to take into account all embedded and run-time loaded swfs as well?</p>
<p>After receiving reports of said infamous debugger on our production swfs and a lot of time spent investigating with <a href="https://addons.mozilla.org/en-US/firefox/addon/5044" target="_blank">Flash Switcher</a> I found a couple insignificant embedded icon swfs and a few run-time loaded font swfs were the debug swf culprits. Duplicating the issue in the Flash 9.0.45.0 Debugger, what made matters worse is that each debug swf that loaded was getting its own modal popup and, atleast in Mac FF3, each consecutive modal popup was showing up blank but still needed to be clicked or the user was locked out of the site.</p>
<p>After another extensive google search the only thing I could find regarding this child swf debugger policy is a brief mention in <a href="http://www.kaourantin.net/2007/12/adobe-flash-player-9-update-3-released.html" target="_blank">Tinc Uro&#8217;s Blog regarding Flash Player 9 Update 3</a> (again Player 9,0,115,0). The one line from his release notes was: &#8220;210746 When a release swf loads a debug swf, flash player doesn&#8217;t look for the debugger&#8221;.  I&#8217;m assuming that this was the &#8220;fix&#8221; as this player version does indeed keep the issue from happening. So to prevent your viewers from ever getting spammed with &#8220;Where is the debugger&#8221; modal windows, ensure all your swfs (embedded and run-time loaded) are non-debug or force your viewers to update to the most recent flash player if they don&#8217;t have atleast 9,0,115,0.</p>
<p>With the proliferation of &#8220;dot&#8221; releases of the Flash Player its now really important to know which sub version of the player you are targeting. Looking at the Flash Player 9 version penetration rates at KickApps I was surprised to find around 80% of our audience had atleast 115. I&#8217;m not sure of the remaining 20% how many are debug players though.</p>
<p>Version        Penetration<br />
9,0,124,0:    ~56%<br />
9,0,115,0:    ~24%<br />
9,0,47,0:     ~10%<br />
9,0,28,0:      ~7%<br />
9,0,45,0:      ~4%</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markledford.com/blog/2008/09/01/mysterious-where-is-the-debugger-or-host-application-running-dialogue-on-non-debug-swfs/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>handy way of removing event listeners via arguments.callee</title>
		<link>http://www.markledford.com/blog/2008/08/09/handy-way-of-removing-event-listeners-via-argumentscallee/</link>
		<comments>http://www.markledford.com/blog/2008/08/09/handy-way-of-removing-event-listeners-via-argumentscallee/#comments</comments>
		<pubDate>Sun, 10 Aug 2008 05:04:36 +0000</pubDate>
		<dc:creator>markledford</dc:creator>
				<category><![CDATA[actionscript]]></category>

		<guid isPermaLink="false">http://www.markledford.com/blog/2008/08/09/handy-way-of-removing-event-listeners-via-argumentscallee/</guid>
		<description><![CDATA[Theo&#8217;s entry reminded me how useful this can be especially when using an anonymous function as a one time callback. Try it out: stage.addEventListener(MouseEvent.MOUSE_DOWN, function(event:Event):void { event.currentTarget.removeEventListener(event.type, arguments.callee); trace(&#8216;ran once&#8217;); }); FYI you should always use event.currentTarget and not event.target when removing a mouse event listener because event.currentTarget will always reference the object that the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.iconara.net/2007/11/05/a-generic-way-to-remove-an-event-listener/" target="_blank">Theo&#8217;s entry</a> reminded me how useful this can be especially when using an anonymous function as a one time callback. Try it out:</p>
<p>stage.addEventListener(MouseEvent.MOUSE_DOWN, function(event:Event):void { event.currentTarget.removeEventListener(event.type, arguments.callee); trace(&#8216;ran once&#8217;); });</p>
<p>FYI you should always use event.currentTarget and not event.target when removing a mouse event listener because event.currentTarget will always reference the object that the listener was explicitly attached to. event.target can easily reference a different object like a child displayObject inside the displayObject you were listening for a bubbling event on.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markledford.com/blog/2008/08/09/handy-way-of-removing-event-listeners-via-argumentscallee/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Event.INIT and Event.COMPLETE don&#8217;t fire when loading an unpacked swc</title>
		<link>http://www.markledford.com/blog/2008/07/24/eventinit-and-eventcomplete-dont-fire-when-loading-an-unpacked-swc/</link>
		<comments>http://www.markledford.com/blog/2008/07/24/eventinit-and-eventcomplete-dont-fire-when-loading-an-unpacked-swc/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 18:01:13 +0000</pubDate>
		<dc:creator>markledford</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.markledford.com/blog/?p=12</guid>
		<description><![CDATA[Cleaning out the wordpress there were a few posts I hadn&#8217;t finished. This one is mainly a for-future-reference for myself. I&#8217;ve been doing some run-time class loading involving loading SWF files into the same ApplicationDomain as the container via Loader then using getDefinitionByName to access new instances of the loaded classes. I was perplexed that [...]]]></description>
			<content:encoded><![CDATA[<p>Cleaning out the wordpress there were a few posts I hadn&#8217;t finished. This one is mainly a for-future-reference for myself.</p>
<p>I&#8217;ve been doing some run-time class loading involving loading SWF files into the same ApplicationDomain as the container via Loader then using getDefinitionByName to access new instances of the loaded classes. I was perplexed that the INIT and COMPLETE events weren&#8217;t being dispatched and found some info <a href="http://blog.andre-michelle.com/2007/generate-accessible-swf-does-not-generate-a-swf/" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markledford.com/blog/2008/07/24/eventinit-and-eventcomplete-dont-fire-when-loading-an-unpacked-swc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SecurityError: Error #2000: No active security context.</title>
		<link>http://www.markledford.com/blog/2008/07/24/securityerror-error-2000-no-active-security-context/</link>
		<comments>http://www.markledford.com/blog/2008/07/24/securityerror-error-2000-no-active-security-context/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 17:51:01 +0000</pubDate>
		<dc:creator>markledford</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[bugs]]></category>

		<guid isPermaLink="false">http://www.markledford.com/blog/?p=15</guid>
		<description><![CDATA[Always interesting to throw an error that has only 4 obscure results in google. Using setTimeout with navigateToURL: var urlRequest:URLRequest = new URLRequest&#40;&#34;http://google.com&#34;&#41;; setTimeout&#40;navigateToURL, 1000, urlRequest, &#34;_blank&#34;&#41;; Generates: SecurityError: Error #2000: No active security context. at global/flash.net::navigateToURL() at Function/http://adobe.com/AS3/2006/builtin::apply() at &#60;anonymous&#62;() at SetIntervalTimer/onTimer() at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick() A work around is to wrap the call [...]]]></description>
			<content:encoded><![CDATA[<p>Always interesting to throw an error that has only 4 obscure results in google.<br />
Using setTimeout with navigateToURL:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6699cc; font-weight: bold;">var</span> urlRequest<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=urlrequest%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlrequest.html"><span style="color: #004993;">URLRequest</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=urlrequest%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlrequest.html"><span style="color: #004993;">URLRequest</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;http://google.com&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #004993;">setTimeout</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">navigateToURL</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1000</span><span style="color: #000066; font-weight: bold;">,</span> urlRequest<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;_blank&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>Generates:<br />
SecurityError: Error #2000: No active security context.<br />
at global/flash.net::navigateToURL()<br />
at Function/http://adobe.com/AS3/2006/builtin::apply()<br />
at &lt;anonymous&gt;()<br />
at SetIntervalTimer/onTimer()<br />
at flash.utils::Timer/_timerDispatch()<br />
at flash.utils::Timer/tick()</p>
<p>A work around is to wrap the call in an anonymous function:<br />
setTimeout(function():void { navigateToURL(urlRequest, &#8220;_blank&#8221;); }, 1000);</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markledford.com/blog/2008/07/24/securityerror-error-2000-no-active-security-context/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>How to make an efficient image proxy</title>
		<link>http://www.markledford.com/blog/2008/02/21/how-to-make-an-efficient-image-proxy/</link>
		<comments>http://www.markledford.com/blog/2008/02/21/how-to-make-an-efficient-image-proxy/#comments</comments>
		<pubDate>Fri, 22 Feb 2008 05:41:39 +0000</pubDate>
		<dc:creator>markledford</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[help]]></category>

		<guid isPermaLink="false">http://www.markledford.com/blog/?p=11</guid>
		<description><![CDATA[So the work I&#8217;m currently doing is centered around loading data from different domains. I&#8217;ve got a proxy setup to get around pesky crossdomain issues but I&#8217;ve been trying to make it a bit dynamic for efficiency&#8217;s sake. I only want to proxy if I know for sure that the data isn&#8217;t coming from our [...]]]></description>
			<content:encoded><![CDATA[<p>So the work I&#8217;m currently doing is centered around loading data from different domains. I&#8217;ve got a proxy setup to get around pesky crossdomain issues but I&#8217;ve been trying to make it a bit dynamic for efficiency&#8217;s sake.  I only want to proxy if I know for sure that the data isn&#8217;t coming from our servers or a server with a crossdomain file in place.</p>
<p>Creating a &#8220;smart&#8221; proxy with the URLLoader for text content is a piece of cake. Simply listen for the SecurityErrorEvent then run the url through the proxy.  Beautifully simple.</p>
<p>For the Loader class its a different story. The Loader class&#8217;s contentLoaderInfo doesn&#8217;t have a security error event, just an ioError event. Your supposed to use the childAllowsParent property of the contentLoaderInfo to figure out whether you have bitmapData level access. The only problem is you can&#8217;t access that property until the  Event.COMPLETE  event is dispatched despite the livedocs LoaderContext page stating <a href="http://livedocs.adobe.com/flex/201/langref/flash/system/LoaderContext.html">this property is available on ProgressEvent.PROGRESS</a> which will throw a Error #2099: The loading object is not sufficiently loaded to provide this information. at flash.display::LoaderInfo/get childAllowsParent()</p>
<p>I can finagle with the LoaderContext and try/catches all I want but there doesn&#8217;t seam to be a creative solution to this problem. The result: I have to load every image that doesn&#8217;t have a policy file TWICE. Once to check childAllowsParent, the next to proxy the image. This doesn&#8217;t make any sense considering on the same livedocs LoaderContext page it states:</p>
<p>When you call the Loader.load() method with LoaderContext.checkPolicyFile set to  true, Flash Player does not begin downloading the specified object in URLRequest.url until it has either successfully downloaded a relevant cross-domain policy file or discovered   that no such policy file exists.</p>
<p>I can see the &#8220;Error: Request for resource at http://&#8230; by requestor from http://&#8230; is denied due to lack of policy file permissions.&#8221; errors being outputted to the console window but I don&#8217;t seam to have a way to catch it in code. Is something as significant as this, really a bug? Can anyone give me a hand?</p>
<p>UPDATE: This does appear to be a bug with proper policy files checking with the Loader class.  The solution: use UILoader for the check, then use Loader with or without proxy. Thanks Brian from picnik.com for the example below in comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markledford.com/blog/2008/02/21/how-to-make-an-efficient-image-proxy/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
