Forked from: alpicola's ワンダフルクエスト用 diff:33 forked from: ワンダフルクエスト用 font: http://slime4.hp.infoseek.co.jp/font/font.html masuda_nahok.. forked:0favorite:0lines:158license : MIT License modified : 2010-06-01 05:34:29 Embed Tweet // forked from 5ivestar's ワンダフルクエスト用 // font: http://slime4.hp.infoseek.co.jp/font/font.html package { import flash.display.*; import flash.display.*; import flash.events.*; import flash.filters.*; import flash.geom.*; import flash.media.*; import flash.net.*; import flash.system.*; import flash.text.*; [SWF(width="465", height="465")] public class Hart extends Spirite{ public function Hart(){ var hart:Sprite = new Sprite(); var g:Graphics = hart.graphics; g.lineStyle(138, 0xFF66CC, 1.0 , false, LineScaleMode.NORMAL, CapsStyle.ROUND, JoinStyle.MITER); g.moveTo(50,50); g.lineTo(100,100); g.lineTo(150,50); hart.x = 50; hart.y = 50; addChild(hart); Wonderfl.capture_delay( 1 ); } } public class DQ extends Sprite { public function DQ() { stage.scaleMode = "noScale"; stage.align = "TL"; Security.loadPolicyFile("http://5ivestar.org/swf/crossdomain.xml"); var loader:Loader = new Loader(); var context:LoaderContext = new LoaderContext(); context.applicationDomain = ApplicationDomain.currentDomain; context.securityDomain = SecurityDomain.currentDomain; loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded); loader.load(new URLRequest("http://5ivestar.org/swf/DQFC.swf"), context); graphics.beginFill(0x000000); graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight); } public function loaded(e:Event):void { var message:DQTextField = new DQTextField(30, 4); message.text = "*「まーくん ハッピーバースデイ!これからも ずっと いっしょだよ!いつも やさしい まーくんでいてね。"; var padding:uint = (stage.stageWidth - message.textWidth) / 2; message.x = padding message.y = stage.stageHeight - message.textHeight - padding; addChild(message); var command:DQTextField = new DQTextField(10, 6); command.caption = "コマンド"; command.text = [ "}ほれなおす ", " でんわをかける", " デートにさそう", " うえのぜんぶ", ].join("\n"); command.x = command.y = padding; addChild(command); } } } import flash.text.*; class DQTextField extends TextField { private var _cols:uint = 30; private var _rows:uint = 3; private var _text:String = ""; private var _caption:String = ""; private static const DAKUON:String = "がぎぐげござずぜぞぢづでばびべぼガギグゲゴザジズゼゾダヂヅデバビブベボ"; private static const HANDAKUON:String = "ぱぴぷぺぽパピプペポ"; public function DQTextField(cols:uint = 30, rows:uint = 3):void { autoSize = "left"; embedFonts = true; multiline = true; background = true; backgroundColor = 0x000000; textColor = 0xFFFFFF; text var fmt:TextFormat = new TextFormat(); fmt.font = "dqfc"; fmt.size = 14; defaultTextFormat = fmt; _cols = cols; _rows = rows; _caption = ""; } override public function get text():String { return _text; } override public function set text(s:String):void { _text = s; super.text = prettify(_text); } public function get cols():uint { return _cols; } public function set cols(i:uint):void { _cols = i; super.text = prettify(_text); } public function get rows():uint { return _rows; } public function set rows(i:uint):void { _rows = i; super.text = prettify(_text); } public function get caption():String { return _caption; } public function set caption(s:String):void { _caption = s; super.text = prettify(_text); } private function prettify(s:String):String { var r:String, c:String; if (_caption == "" || _cols < 3) { r = "&" + repeat("#", _cols) + "’\n"; } else { c = _caption.substr(0, _cols - 2); var l:uint = (_cols - c.length) / 2; r = "&" + repeat("#", l - 1) + "=" + c + repeat("#", l + (_cols - c.length) % 2) + "’\n"; } var lines:Array = s.split("\n"); for (var i:int = 0; i < _rows; i++) { var line:String = lines.shift() || ""; var buf:Array = ["”", "”"]; if (line.length > _cols) { lines.unshift(line.substring(_cols)); } for (var j:int = 0; j < _cols; j++) { c = line.charAt(j); if (c == "" || c == " ") c = " "; if (DAKUON.indexOf(c) != -1) { buf[0] += "<"; buf[1] += String.fromCharCode(c.charCodeAt(0) - 1); } else if (HANDAKUON.indexOf(c) != -1) { buf[0] += ">"; buf[1] += String.fromCharCode(c.charCodeAt(0) - 2); } else { buf[0] += " "; buf[1] += c; } } buf[0] += "$"; buf[1] += "$"; r += buf.join("\n"); r += "\n"; } r += ")" + repeat("%", _cols) + "("; return r; } private function repeat(s:String, n:int):String { var r:String = ''; while (n--) r += s; return r; } } Code Fullscreen Preview Fullscreen icu-cg2010 repeat charCodeAt String.fromCharCode message LineScaleMode.NORMAL String JointStyle.MITER embedFonts substring text CapsStyle.ROUND backgroundColor unshift background textWidth join Security.loadPolicyFile textHeight substr split