Quine作成中(まだ未完成)
作成中です。
under construction
/**
* Copyright hirose_golf ( http://wonderfl.net/user/hirose_golf )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/gfwW
*/
// under construction
// forked from yonatan's Quine
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
import com.bit101.components.VScrollBar;
public class Quine extends Sprite {
public function Aaa(item:String, index:int, array:Array):String {
var pre:String=String(index);
while(pre.length<2){
pre=" "+pre;
}
return pre+" "+item;
}
public function Quine() {
var tf:TextField = new TextField();
addChild(tf);
tf.width = tf.height = 430;
tf.background = true;
tf.backgroundColor = 0x000000;
tf.textColor = 0xffffff;
tf.type = "input";
var format:TextFormat = new TextFormat();
format.size = 12;
format.color = 0xffffff;
format.font = "Courier New"
format.leading = 4;
tf.defaultTextFormat = format;
var vs:VScrollBar;
vs = new VScrollBar(this, tf.x + tf.width, tf.y);
VScrollBar()
var quine:String = <![CDATA[// forked from yonatan's Quine
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
public class Quine extends Sprite {
public function Quine() {
var tf:TextField = new TextField();
addChild(tf);
tf.width = tf.height = 465;
tf.background = true;
tf.backgroundColor = 0x000000;
tf.textColor = 0xffffff;
tf.type = "input";
var format:TextFormat = new TextFormat();
format.size = 12;
format.color = 0xffffff;
format.font = "Courier New"
format.leading = 4;
tf.defaultTextFormat = format;
var quine:String = <![CDATA[@]>.toString();
tf.text = quine.replace(String.fromCharCode(64), quine + "]");
}
}
}
]]>.toString();
var pat:RegExp = /package|class|function|var/g;
quine = quine.replace(pat, "<font color=\"#ff9f80\">$&</font>");
var pat2:RegExp = /import|public|extends|new|true/g;
quine = quine.replace(pat2, "<font color=\"#ff5020\">$&</font>");
var qs: Array= quine.split("\n");
quine = qs.map(Aaa).join("\r");
tf.htmlText = quine.replace(String.fromCharCode(64), quine + "]");
}
}
}