Zigue-Zague Decryption
Click play.
Enter encrypted text in the boxy. Click to decrypt.
/**
* Copyright Josflos ( http://wonderfl.net/user/Josflos )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/njdX
*/
package {
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.display.Sprite;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;
public class FlashTest extends Sprite {
public var input:TextField;
public var tf:TextField;
public var tf2:TextField;
public function FlashTest() {
input = new TextField();
addChild(input);
input.border = true;
input.autoSize = TextFieldAutoSize.LEFT;
input.type = TextFieldType.INPUT;
stage.addEventListener(MouseEvent.CLICK, decrypt);
tf = new TextField();
addChild(tf);
tf.autoSize = TextFieldAutoSize.LEFT;
tf.y = 30;
tf2 = new TextField();
addChild(tf2);
tf2.y = 90;
tf2.autoSize = TextFieldAutoSize.LEFT;
}
public function decrypt(e:MouseEvent):void
{
var encrypted:String = input.text;
var row1:String = encrypted.slice(0, encrypted.length / 2);
var row2:String = encrypted.slice(encrypted.length / 2, encrypted.length);
tf.text = row1 + "\n" + row2;
var decrypted:String = "";
for (var i:uint = 0; i < row1.length; i++)
{
decrypted += row1.charAt(i);
decrypted += row2.charAt(i);
}
tf2.text = decrypted;
}
}
}