TheJach.com

Jach's personal blog

(Largely containing a mind-dump to myselves: past, present, and future)
Current favorite quote: "Supposedly smart people are weirdly ignorant of Bayes' Rule." William B Vogt, 2010

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:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%">
<s:layout>
<s:VerticalLayout paddingLeft="10" paddingRight="10" paddingBottom="10" paddingTop="10" />
</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

Permalink: https://www.thejach.com/view/id/176

Trackback URL: https://www.thejach.com/view/2011/6/crab_canon_maker_in_flex

Back to the top

Back to the first comment

Comment using the form below

(Only if you want to be notified of further responses, never displayed.)

Your Comment:

LaTeX allowed in comments, use $$\$\$...\$\$$$ to wrap inline and $$[math]...[/math]$$ to wrap blocks.