<?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>Metal Fish Eggs &#187; actionscript</title>
	<atom:link href="http://blog.zincroe.com/tag/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.zincroe.com</link>
	<description>Ramblings from the team at zinc Roe</description>
	<lastBuildDate>Tue, 17 Jan 2012 21:48:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.6</generator>
		<item>
		<title>Mirrored Video Object in Flash</title>
		<link>http://blog.zincroe.com/2010/07/mirrored-video-object-in-flash/</link>
		<comments>http://blog.zincroe.com/2010/07/mirrored-video-object-in-flash/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 20:29:34 +0000</pubDate>
		<dc:creator>Carlo</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[mirror]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[webcam]]></category>

		<guid isPermaLink="false">http://blog.zincroe.com/?p=674</guid>
		<description><![CDATA[When using the webcam in your flash applications, it can be handy to flip the video object so it acts like a mirror. Many of the flash webcam demos out there does exactly this, usually by setting the scaleX property of the video object to -1. Unfortunately, because the registration point of the video object [...]]]></description>
			<content:encoded><![CDATA[<p>When using the webcam in your flash applications, it can be handy to flip the video object so it acts like a mirror. Many of the flash webcam demos out there does exactly this, usually by setting the scaleX property of the video object to -1. Unfortunately, because the registration point of the video object is set on the top left corner, setting the scaleX property to a negative value moves the display object like flipping a page in a book from right to left.</p>
<div id="attachment_675" class="wp-caption aligncenter" style="width: 478px"><a href="http://blog.zincroe.com/wp-content/uploads/2010/07/reg_point.jpg"><img src="http://blog.zincroe.com/wp-content/uploads/2010/07/reg_point.jpg" alt="Setting scaleX to -1 on a display object" title="Setting scaleX to -1 on a display object" width="468" height="257" class="size-full wp-image-675" /></a><p class="wp-caption-text">Setting scaleX to -1 on a display object</p></div>
<p>Of course, you can easily place the video object back to where it was by compensating for the flip and adding the video object&#8217;s width to it&#8217;s current x value. While this solution works for most applications, there is one annoying thing about this method. If you ever want to move the video object around the stage or play with it&#8217;s scaleX value, there&#8217;s going to be a lot of compensating going on and it can get messy quick depending on the complexity of your application.</p>
<p>So to make it easier, here&#8217;s a class that extends the Video object and adds a &#8220;flipped&#8221; property. I don&#8217;t think I need to explain what the property does, but the class overrides the x and scaleX properties of Video so that it takes care of all the positioning when flipping the display object. Check out the demo [webcam required]:</p>
<p><object id="MirrorDemo" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="align" value="middle" /><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="quality" value="high" /><param name="bgcolor" value="#cccccc" /><param name="src" value="http://blog.zincroe.com/wp-content/uploads/2010/07/HardwareDetection.swf" /><param name="name" value="MirrorDemo" /><param name="allowfullscreen" value="false" /><embed id="MirrorDemo" type="application/x-shockwave-flash" width="550" height="400" src="http://blog.zincroe.com/wp-content/uploads/2010/07/HardwareDetection.swf" name="MirrorDemo" bgcolor="#cccccc" quality="high" allowfullscreen="false" allowscriptaccess="sameDomain" align="middle"></embed></object></p>
<p>Even when flipped, the x property always references the left side of the video object and the scaleX remains the same. Here&#8217;s the source: <a href='http://blog.zincroe.com/wp-content/uploads/2010/07/MirrorDemo.zip'>MirrorDemo.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zincroe.com/2010/07/mirrored-video-object-in-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Label Utility Class</title>
		<link>http://blog.zincroe.com/2008/10/label-utility-class/</link>
		<comments>http://blog.zincroe.com/2008/10/label-utility-class/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 21:53:22 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[actionscript]]></category>

		<guid isPermaLink="false">http://blog.zincroe.com/?p=48</guid>
		<description><![CDATA[One problem I always run into when developing a game in Flash is how to tell when a timeline animation is finished. The quick and dirty solution is to put some callback functions on a frame (or two or three) on the MovieClip&#8217;s timeline. This works well for simple cases, but gets messy quickly. And [...]]]></description>
			<content:encoded><![CDATA[<p>One problem I always run into when developing a game in Flash is how to tell when a timeline animation is finished.</p>
<p>The quick and dirty solution is to put some callback functions on a frame (or two or three) on the MovieClip&#8217;s timeline. This works well for simple cases, but gets messy quickly. And the problem gets worse when you create subclasses and have to maintain all those timeline actions manually. Ugh.</p>
<p>In ActionScript 3, all of the frame labels in a MovieClip are available through its <code>currentLabels</code> property, and the undocumented <code>addFrameScript()</code> method lets you add code to it&#8217;s timeline at run time. Put them together and you can read the frame labels to figure out where the code should go, then add it to the timeline at programatically. Presto! No more ActionScript in your FLA. Since I&#8217;m lazy, I wrote a <a href='http://blog.zincroe.com/wp-content/uploads/2008/10/Label.as'>Label</a> utility class to do all the dirty work :-)</p>
<p>The code below shows an example of a player sprite with idle and attack animations. The timeline has two labelled keyframes, &#8216;idle&#8217; and &#8216;attack&#8217;. The constructor function checks to make sure both labels exist, then starts the idle animation, which loops until  attack() is called. When attack() is called, the attack animation plays once, then idle() is called and the idle animation starts looping again.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">import</span> com.zincroe.display.Label;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">MovieClip</span>;
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Player<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Player<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span>Label.find<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span>, <span style="color: #990000;">'attack'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                <span style="color: #0033ff; font-weight: bold;">throw</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Error</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">'Label missing: attack'</span><span style="color: #000000;">&#41;</span>;
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span>Label.find<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span>, <span style="color: #990000;">'idle'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                <span style="color: #0033ff; font-weight: bold;">throw</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Error</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">'Label missing: idle'</span><span style="color: #000000;">&#41;</span>;
            <span style="color: #000000;">&#125;</span>
            idle<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #339966; font-weight: bold;">function</span> attack<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            Label.<span style="color: #004993;">play</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span>, <span style="color: #990000;">'attack'</span>, attackComplete<span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #339966; font-weight: bold;">function</span> attackComplete<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            idle<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #339966; font-weight: bold;">function</span> idle<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            Label.<span style="color: #004993;">play</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span>, <span style="color: #990000;">'idle'</span>, idleComplete<span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #339966; font-weight: bold;">function</span> idleComplete<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            Label.repeat<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span>, <span style="color: #990000;">'idle'</span>, idle<span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Download the <a href='http://blog.zincroe.com/wp-content/uploads/2008/10/Label.as'>Label</a> utility class.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zincroe.com/2008/10/label-utility-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Real Page Turner</title>
		<link>http://blog.zincroe.com/2008/04/a-real-page-turner/</link>
		<comments>http://blog.zincroe.com/2008/04/a-real-page-turner/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 17:40:22 +0000</pubDate>
		<dc:creator>Davin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as2]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[silverlight]]></category>

		<guid isPermaLink="false">http://blog.zincroe.com/?p=3</guid>
		<description><![CDATA[A few years ago, zinc Roe began working with the Toronto Public Library to develop a tool for displaying archival books from their various special collections branches. The library’s inspiration was Turning the Pages; a tool created by the British Library that, at the time, required the Shockwave plug-in (The British Library has recently produced [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.zincroe.com/wp-content/uploads/2008/04/vbook-300x184.jpg" alt="Ontario Time Machine page Turner example" title="Ontario Time Machine - Page Turner example" width="300" height="184" class="alignright" />A few years ago, zinc Roe began working with the <a href="http://www.torontopubliclibrary.ca/">Toronto Public Library</a> to develop a tool for displaying archival books from their various special collections branches. The library’s inspiration was <a href="http://www.bl.uk/onlinegallery/ttp/ttpbooks.html"><em>Turning the Pages</em></a>; a tool created by the British Library that, at the time, required the Shockwave plug-in (The British Library has recently produced <a href="http://www.bl.uk/ttp2/ttp2.html"><em>Turning the Pages 2.0</em></a> as a Windows Vista / Silverlight application). <em>Turning the Pages</em> was available for license through the British Library, but the Toronto Public Library saw the benefit of developing a tool from the ground up which would share the same basic premise but expand the feature set with the main goal being a well presented source document that could be supplemented with further text, images, audio, and video.</p>
<p>We also knew that we wanted to create both the book assembly and viewing tool in Flash as opposed to Director. The tool is written in <abbr title="ActionScript 1">AS1</abbr> and uses Screentime Media’s MProjector software to create a standalone tool for creating the bundles of assets and text that are loaded into the viewer which works equally well locally or online.</p>
<p>What we see now as a version 1.0 tool has been used successfully by the Toronto Public Library in a public touch-screen kiosk format at the Metro Reference Library and had it’s widest release just recently as the core of a jointly produced project called <a href="http://www.ontariotimemachine.ca/"><em>Ontario Time Machine</em></a>.</p>
<p>At this year’s <a href="http://www.sxsw.com/">SXSWi</a> and the <a href="http://www.archimuse.com/mw2008/index.html">Museums and the Web</a> conferences, the “VirtualBook” or “Page Turner” (it needs a real name) was greeted with interest by quite a few people from libraries and museums and it got us thinking about the possibility of a version 2.0 which would build upon the functionality and strengths of the existing version.</p>
<p>We know some of our basic goals in working towards a new version:</p>
<ul>
<li>Author in <abbr title="ActionScript 3">AS3</abbr> (bitmap handling and more structured code just a couple of the reasons)</li>
<li>Streamline the book assembly process and application (cross-platform desktop application and/or hosted process)</li>
<li>Make the viewing interface relatively “skinnable”</li>
<li>Expand the display/export options (Flash viewer, HTML view, text only, PDF, etc.)</li>
<li>Open the process and the product up to benefit from outside knowledge, criticism, and development</li>
</ul>
<p>The first step in this is this post. We know there are a number of projects with similar goals out there in varying stages of production and we certainly have our personal opinions of where those tools succeed and fail but we would love some direct public feedback on what we have done with version 1.0 and on an on-going basis as we work towards a new version.</p>
<p>As an aside, here are a few companies and organizations with related goals or technology: <a href="http://www.openlibrary.org/">Open Library</a>, <a href="http://books.google.com/">Google Book Search</a>, <a href="http://www.zoomify.com/">Zoomify</a>, and <a href="http://issuu.com/">Issuu</a>, Any others?</p>
<p><em>P.S. Please excuse the extremely punny title of this post. I shall endeavour to keep humour reigned-in during all future internet ramblings. Some may say it has been suitable reigned in that they noticed no humour present herein. To them, point taken.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zincroe.com/2008/04/a-real-page-turner/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

