forked from: ワンダフルクエスト用
font: http://slime4.hp.infoseek.co.jp/font/font.html
/**
* Copyright masuda_nahoko ( http://wonderfl.net/user/masuda_nahoko )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/vca5
*/
// forked from 5ivestar's ワンダフルクエスト用
// font: http://slime4.hp.infoseek.co.jp/font/font.html
package {
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.display.Splite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.NetStatusEvent;
import flash.media.Video;
import flash.net.FileReference;
import flash.net.NetConnection;
import flash.net.NetStream;
[SWF(width="465", height="465")]
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(false);
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(13,5);
command.caption = "コマンド";
command.text = [
" よろこぶ うれしなき",
"}ほれなおす でんわする",
" てとりす デートにさそう",
].join("\n");
command.x = command.y = padding;
addChild(command);
}
}
}
package {
import flash.display.Sprite;
public class main extends Sprite
{
private var _connection:NetConnection ;
private var _stream:NetStream;
private var _video:Video = new Video();
private var _videoURL:String = "http://www.muraken.biz/wonderfl/construction.mp4";
public function Main() {
addChild(_video);
//sa-ba-nitunagu
_connection= new NetConnection();
_connection.addEventListerner(NetStatusEvent.NET_STATUS,_netStatusHandler)
_connection.connect(null);
}
private function _netStatusHandler(e:NetStatusEvent):void {
if (e.info.code == "NetConnection.Connect.Success") {//setuzokugakannryou
_connectStream();
}
}
private function _connectStream():void {
//suidoukannnijyagutiwotoritukeru
_stream = new NetStream(_connection);
_stream..addEventListener(NetStatusEvent.NET_STATUS, _netStatusHandler);
_stream.client = this;
//koppuwoyoui
addChild(_video);
_video.attachNetStream(_stream);
_video.x = Math.floor((stage.stageWidth - _video.width) / 2) ;
_video.y = Math.floor((stage.stageHeight -_video.height) / 2) ;
_stream.play(_videoURL);
}
public function onCuePoint(info:Object):void { }
public function onXMPData(info:Object):void { }
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;
}
}