<?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>rel=me &#187; Flash</title>
	<atom:link href="http://rel.me/t/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://rel.me</link>
	<description>programming, objective-c, cocoa, iphone, c</description>
	<lastBuildDate>Wed, 01 Feb 2012 07:26:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Font detection with Javascript and Flash</title>
		<link>http://rel.me/2008/06/26/font-detection-with-javascript-and-flash/</link>
		<comments>http://rel.me/2008/06/26/font-detection-with-javascript-and-flash/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 22:08:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[fonts]]></category>

		<guid isPermaLink="false">/2008/06/26/font-detection-with-javascript-and-flash</guid>
		<description><![CDATA[View the demo now I was playing around with jquery and I wanted to see if it was possible to generate a cheat sheet of all the fonts on your system. Its also a good run through of how to load a SWF with a callback. View a demo The steps I used to generate [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://font-detect.s3.amazonaws.com/index.html">View the demo now</a></p>
<p>I was playing around with jquery and I wanted to see if it was possible to generate a cheat sheet of all the fonts on your system. Its also a good run through of how to load a SWF with a callback.</p>
<p><img src="http://font-detect.s3.amazonaws.com/font-detect.png" alt="" width="583" height="335" /></p>
<p><a href="http://font-detect.s3.amazonaws.com/index.html">View a demo</a></p>
<p>The steps I used to generate this are:</p>
<ul>
<li>Load SWF</li>
<li>Javascript calls to Actionscript fonts() method via <code>ExternalInterface</code></li>
<li>Get the list of system fonts in Flash via <code>Font.enumerateFonts(true)</code></li>
<li>Curse Flash for giving you a list of font names, where half of them are garbage.</li>
<li>For each font name, in javascript, create a test which adds a DOM element temporarily with a fallback font family set. For example, <code>font-family: 'Apple Garamond Pro', 'Times New Roman';</code>, where Times New Roman is your fallback.</li>
<li>Then check the actual width (via offsetWidth). If it does not match the offsetWidth of the fallback font, then we know it rendered ok. (The original idea is from <a href="http://www.lalit.org/lab/javascript-css-font-detect">http://www.lalit.org/lab/javascript-css-font-detect</a>)</li>
</ul>
<p>The only caveat is, if the actual font width and the fallback font width do match, then you would have a false negative. So its not bulletproof.</p>
<p>The actionscript to enumerate the fonts and call back out is pretty simple:<br />
<script type="text/javascript" src="http://gist.github.com/138691.js"></script><br />
 Expose the method in the constructor using ExternalInterface:<br />
<script type="text/javascript" src="http://gist.github.com/138692.js"></script><br />
<a href="http://github.com/gabriel/font-detect-js/tree/master/flash/src/FontList.as">FontList.as</a></p>
<p>I used swfobject to load the SWF. Also be sure to enable <code>allowScriptAccess</code>.</p>
<p>The javascript to test the fonts is at: <a href="http://github.com/gabriel/font-detect-js/tree/master/javascripts/font-detect.js">font-detect.js</a></p>
<p>You can use it by including:</p>
<p>&nbsp;</p>
<p>In the end, I don&#8217;t think this is useful in practice, but I thought I would share anyway. Its on <a href="http://github.com/gabriel/font-detect-js/tree/master">github</a> too.</p>
<p><strong>Updated:</strong> Now uses call straight to actionscript, doesn&#8217;t marshall JSON first so its much faster, and other refactoring.</p>
]]></content:encoded>
			<wfw:commentRss>http://rel.me/2008/06/26/font-detection-with-javascript-and-flash/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Memory usage during file upload in AIR</title>
		<link>http://rel.me/2008/03/29/memory-usage-during-file-upload-in-air/</link>
		<comments>http://rel.me/2008/03/29/memory-usage-during-file-upload-in-air/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 00:47:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">/2008/03/29/memory-usage-during-file-upload-in-air</guid>
		<description><![CDATA[Uploading files in AIR is a little bit problematic these days. Here is the code: &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;mx:WindowedApplication xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;absolute&#34; showStatusBar=&#34;false&#34; initialize=&#34;onInitialize(event)&#34;&#62; &#160; &#60;mx:Script&#62; &#60;!&#91;CDATA&#91; &#160; import com.rwnage.s3.service.S3PostOptions; import flash.events.Event; &#160; public function onInitialize&#40;event:Event&#41;:void &#123; var accessKey:String = &#34;0RXZ3R7Y034PA8VGNWR2&#34;; var bucketName:String = &#34;rwnage_test&#34;; var objectName:String = &#34;test_file&#34;; var contentType:String = &#34;application/octet-stream&#34;; var secretAccessKey:String = [...]]]></description>
			<content:encoded><![CDATA[<p>Uploading files in AIR is a little bit problematic these days.</p>
<p>Here is the code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span class="sy0">&lt;</span>?<span class="kw3">xml</span> <span class="kw3">version</span>=<span class="st0">&quot;1.0&quot;</span> encoding=<span class="st0">&quot;utf-8&quot;</span>?<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>mx:WindowedApplication xmlns:mx=<span class="st0">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span class="st0">&quot;absolute&quot;</span> showStatusBar=<span class="st0">&quot;false&quot;</span> 
  initialize=<span class="st0">&quot;onInitialize(event)&quot;</span><span class="sy0">&gt;</span>  
&nbsp;
  <span class="sy0">&lt;</span>mx:Script<span class="sy0">&gt;</span>
    <span class="sy0">&lt;!</span><span class="br0">&#91;</span>CDATA<span class="br0">&#91;</span>
&nbsp;
      <span class="kw3">import</span> com.<span class="me1">rwnage</span>.<span class="me1">s3</span>.<span class="me1">service</span>.<span class="me1">S3PostOptions</span>;
      <span class="kw3">import</span> flash.<span class="me1">events</span>.<span class="me1">Event</span>;
&nbsp;
      <span class="kw3">public</span> <span class="kw2">function</span> onInitialize<span class="br0">&#40;</span>event:Event<span class="br0">&#41;</span>:<span class="kw3">void</span> <span class="br0">&#123;</span>
        <span class="kw2">var</span> accessKey:<span class="kw3">String</span> = <span class="st0">&quot;0RXZ3R7Y034PA8VGNWR2&quot;</span>;
        <span class="kw2">var</span> bucketName:<span class="kw3">String</span> = <span class="st0">&quot;rwnage_test&quot;</span>;
        <span class="kw2">var</span> objectName:<span class="kw3">String</span> = <span class="st0">&quot;test_file&quot;</span>;
        <span class="kw2">var</span> <span class="kw3">contentType</span>:<span class="kw3">String</span> = <span class="st0">&quot;application/octet-stream&quot;</span>;
        <span class="kw2">var</span> secretAccessKey:<span class="kw3">String</span> = <span class="st0">&quot;[PUT YOUR SECRET ACCESS KEY HERE]&quot;</span>;      
&nbsp;
        <span class="kw2">var</span> postOptions:S3PostOptions = <span class="kw2">new</span> S3PostOptions<span class="br0">&#40;</span>bucketName, objectName, accessKey, 
          <span class="br0">&#123;</span> <span class="kw3">contentType</span>: <span class="kw3">contentType</span> <span class="br0">&#125;</span><span class="br0">&#41;</span>;
&nbsp;
        <span class="kw2">var</span> policy:<span class="kw3">String</span> = postOptions.<span class="me1">getPolicy</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;
        <span class="kw2">var</span> signature:<span class="kw3">String</span> = postOptions.<span class="me1">getSignature</span><span class="br0">&#40;</span>secretAccessKey, policy<span class="br0">&#41;</span>;
&nbsp;
        <span class="kw3">html</span>.<span class="kw3">htmlText</span> = <span class="st0">'&lt;html&gt;&lt;body&gt; <span class="es0">\</span>
          &lt;form name=&quot;upload&quot; action=&quot;http://'</span> + bucketName + <span class="st0">'.s3.amazonaws.com/&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt; <span class="es0">\</span>
            Key to upload: &lt;input type=&quot;input&quot; name=&quot;key&quot; value=&quot;'</span> + objectName + <span class="st0">'&quot; /&gt;&lt;br /&gt; <span class="es0">\</span>
            Content-Type: &lt;input type=&quot;input&quot; name=&quot;Content-Type&quot; value=&quot;'</span> + <span class="kw3">contentType</span> + <span class="st0">'&quot; /&gt;&lt;br /&gt; <span class="es0">\</span>
            &lt;input type=&quot;hidden&quot; name=&quot;AWSAccessKeyId&quot; value=&quot;'</span> + accessKey + <span class="st0">'&quot; /&gt; <span class="es0">\</span>
            &lt;input type=&quot;hidden&quot; name=&quot;Policy&quot; value=&quot;'</span> + policy + <span class="st0">'&quot; /&gt; <span class="es0">\</span>
            &lt;input type=&quot;hidden&quot; name=&quot;Signature&quot; value=&quot;'</span> + signature + <span class="st0">'&quot; /&gt; <span class="es0">\</span>
            File: &lt;input type=&quot;file&quot; name=&quot;file&quot; /&gt; &lt;br /&gt; <span class="es0">\</span>
            &lt;!-- The elements after this will be ignored --&gt; <span class="es0">\</span>
            &lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Upload to Amazon S3&quot; /&gt; <span class="es0">\</span>
          &lt;/form&gt;&lt;/body&gt;&lt;/html&gt;'</span>;                                                     
      <span class="br0">&#125;</span>
&nbsp;
    <span class="br0">&#93;</span><span class="br0">&#93;</span><span class="sy0">&gt;</span>
  <span class="sy0">&lt;/</span>mx:Script<span class="sy0">&gt;</span>
&nbsp;
  <span class="sy0">&lt;</span>mx:<span class="kw3">HTML</span> id=<span class="st0">&quot;html&quot;</span> <span class="kw3">width</span>=<span class="st0">&quot;100%&quot;</span> <span class="kw3">height</span>=<span class="st0">&quot;100%&quot;</span> paddingLeft=<span class="st0">&quot;20&quot;</span> paddingTop=<span class="st0">&quot;20&quot;</span><span class="sy0">/&gt;</span>
&nbsp;
<span class="sy0">&lt;/</span>mx:WindowedApplication<span class="sy0">&gt;</span></pre></div></div>

<p><em>No I don&#8217;t normally use mx:script tags, its a test case.</em></p>
<p>Eventually it malloc fails and crashes. This issue is Mac only and also occurs during a FileReference (or File) <a href="http://livedocs.adobe.com/labs/flex3/langref/flash/net/FileReference.html#upload()">upload</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://rel.me/2008/03/29/memory-usage-during-file-upload-in-air/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ASProject now Sprouts</title>
		<link>http://rel.me/2007/06/14/asproject-now-sprouts/</link>
		<comments>http://rel.me/2007/06/14/asproject-now-sprouts/#comments</comments>
		<pubDate>Thu, 14 Jun 2007 01:12:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[asproject]]></category>
		<category><![CDATA[asunit]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">/2007/06/14/asproject-now-sprouts</guid>
		<description><![CDATA[&#34;I introduced AsProject in April and have since been redesigning it under a new, much more manageable project called Sprouts.&#34; http://www.asserttrue.com/articles/2007/06/13/announcing-sprouts-was-asproject]]></description>
			<content:encoded><![CDATA[<blockquote><p>
&quot;I introduced AsProject in April and have since been redesigning it under a new, much more manageable project called Sprouts.&quot;
</p></blockquote>
<p><a href="http://www.asserttrue.com/articles/2007/06/13/announcing-sprouts-was-asproject">http://www.asserttrue.com/articles/2007/06/13/announcing-sprouts-was-asproject</a></p>
]]></content:encoded>
			<wfw:commentRss>http://rel.me/2007/06/14/asproject-now-sprouts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASProject and Flash debugging to Firebug console</title>
		<link>http://rel.me/2007/04/12/asproject-and-flash-debugging-to-firebug-console/</link>
		<comments>http://rel.me/2007/04/12/asproject-and-flash-debugging-to-firebug-console/#comments</comments>
		<pubDate>Thu, 12 Apr 2007 02:47:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[asproject]]></category>
		<category><![CDATA[asunit]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">/2007/09/03/asproject-and-flash-debugging-to-firebug-console</guid>
		<description><![CDATA[Publishing, testing, and running Actionscript projects is a pain. &#8220;AsProject automates a variety of tasks including the creation of projects, classes, test cases, test suites, and swfmill libraries. It automates the download, installation and configuration of the debug flash player and many open source tools. AsProject also includes sophisticated build tools written in rake to [...]]]></description>
			<content:encoded><![CDATA[<p>Publishing, testing, and running Actionscript projects is a pain.</p>
<blockquote><p>
&#8220;AsProject automates a variety of tasks including the creation of projects, classes, test cases, test suites, and swfmill libraries. It automates the download, installation and configuration of the debug flash player and many open source tools. AsProject also includes sophisticated build tools written in rake to automate build processes.&#8221;
</p></blockquote>
<p><a href="http://www.asserttrue.com/articles/2007/04/04/introducing-asproject">Video demo</a> or <a href="http://code.google.com/p/asproject/">Project page</a></p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre><tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">gem install asproject</pre>
</td>
</tr>
</table>
<p>Also, a friend <a href="http://www.justsuppose.com/">Corey</a> pointed out that you can debug flash using Actionscript ExternalInterface to log to Firebug console.log instead of using ASUnit&#8217;s debug console. In your actionscript: </p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre><tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"> ExternalInterface.call(&quot;console.log&quot;, &quot;FLASH: &quot; + s);</pre>
</td>
</tr>
</table>
<p>And make sure to allowScriptAccess.</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">var so = new SWFObject(&quot;flash/xxx.swf&quot;, &quot;myswf&quot;, &quot;680&quot;, &quot;200&quot;, &quot;8&quot;, &quot;#FFFFFF&quot;);<tt>
</tt> so.addParam(&quot;allowScriptAccess&quot;, &quot;always&quot;);<tt>
</tt> so.write(&quot;xxx&quot;);</pre>
</td>
</tr>
</table>
<p>And you could call any javascript from it. <a href="http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&#038;file=00002200.html">ExternalInterface </a> is a replacement for fscommand. I don&#8217;t remember but I don&#8217;t think ExternalInterface works in all browsers.</p>
]]></content:encoded>
			<wfw:commentRss>http://rel.me/2007/04/12/asproject-and-flash-debugging-to-firebug-console/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

