flash on 2010-5-6
♥0 |
Line 37 |
Modified 2010-05-06 05:53:33 |
MIT License
archived:2017-03-30 02:21:05
ActionScript3 source code
/**
* Copyright kihon ( http://wonderfl.net/user/kihon )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/9mKI
*/
package
{
import com.bit101.components.PushButton;
import com.bit101.components.TextArea;
import flash.display.Sprite;
import flash.events.Event;
public class Main extends Sprite
{
private var srcArea:TextArea;
private var destArea:TextArea;
public function Main()
{
srcArea = new TextArea(this, 0, 0, "FLASH");
destArea = new TextArea(this, 0, 0);
srcArea.width = destArea.width = stage.stageWidth;
srcArea.height = 100;
var button:PushButton = new PushButton(this, 0, srcArea.height + 10, "Encryption", onClick);
destArea.y = button.y + 50;
destArea.height = stage.stageHeight - destArea.y;
}
private function onClick(event:Event = null):void
{
destArea.text = rot13(srcArea.text);
}
private function rot13(src:String):String
{
var tableA:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
var tableB:String = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm";
var dest:String = "";
for (var i:int = 0; i < src.length; i++)
{
dest += tableB.charAt(tableA.indexOf(src.charAt(i)));
}
return dest;
}
}
}