# Crab Canon Maker In Flex

This crab canon appeared on Hacker News recently, I thought it was really pretty. I started writing my own (I'll post it whenever I finish if I think it's good enough), but noticed that it was fairly hard to do in my head. The amount of context you have to keep track of... Anyway, I took 5-10 minutes or so to write a Canon Maker in Flex that just copies what you wrote and duplicates it to mirror itself.

Source for anyone interested (also below)

<?xml version="1.0" encoding="utf-8"?>
<s:layout>
</s:layout>
<fx:Declarations>
</fx:Declarations>
<s:TextArea id="norm" change="alter();" width="100%" height="100%" />
<s:TextArea id="poem" width="100%" height="100%" />
<fx:Script>
<![CDATA[
public function alter():void {
poem.text = norm.text + '\n' + norm.text.split('\n').slice(0, -1).reverse().join('\n');
}
]]>
</fx:Script>
</s:Application>



#### Posted on 2011-06-11 by Jach

Tags: flex

LaTeX allowed in comments, use $\\...\\$\$ to wrap inline and $$...$$ to wrap blocks.