高橋メソッド on Flash (Stub)
/**
* Copyright orz34 ( http://wonderfl.net/user/orz34 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/b4lr
*/
// 高橋メソッドをFlashで再現してみました。
// 高橋メソッド http://www.rubycolor.org/takahashi/
package {
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.text.*;
import flash.display.Sprite;
[SWF(width=320,height=320)]
public class TakahashiMethod extends Sprite {
private var text:TextField = new TextField;
private var temp:TextField = new TextField;
private var tf:TextFormat = new TextFormat;
private var num:uint = 0;
private var font:String = "_ゴシック";
private var slide:Vector.<String> = Vector.<String>([
"高橋\nメソッド",
"プレゼン\nテーション\nの手法",
"特徴",
"文字が\nデカい",
"簡潔",
"メリット",
"見やすい",
"わかりやすい",
"話に\n集中できる",
"デメリット",
"ネタに\n走りがち",
"重要な\nプレゼンでは\nお勧めできない",
"ご清聴\nありがとう\nございました"
]);
public function TakahashiMethod() {
temp.defaultTextFormat = new TextFormat(font, 64, null, true);
tf.align = TextFormatAlign.CENTER;
tf.font = font;
tf.bold = true;
text.defaultTextFormat = tf;
text.selectable = false;
this.mouseEnabled = true;
this.buttonMode = true;
text.width = 320;
text.background = true;
text.backgroundColor = 0xEEEEEE;
addChild(text);
stage.addEventListener(MouseEvent.CLICK, nextSlide);
nextSlide();
}
private function calcSize(str:String):int {
temp.text = str;
return Math.floor((320-40) * 64 / Math.max(temp.textWidth, temp.textHeight));
//return Math.min(Math.floor((320-40) * 64 / temp.textWidth), Math.floor((320-40) * 64 / temp.textHeight));
}
public function nextSlide(e:Event = null):void {
if(num >= slide.length) num = 0;
var str:String = slide[num++];
tf.size = calcSize(str);
text.defaultTextFormat = tf;
text.text = str;
text.height = text.textHeight + 4;
text.y = 160 - text.textHeight / 2 - 2;
}
}
}