In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: forked from: 吹き出しクラス

// forked from kidaipu's forked from: 吹き出しクラス
// forked from tatsuya's 吹き出しクラス
package {
    import flash.display.Sprite;
    [SWF(width=465, height=465, backgroundColor=0xFFFFFF, frameRate=30)]

    public class FlashTest extends Sprite {
        public function FlashTest() {
              var fk:Fukidashi = new Fukidashi("東京\n",240,100);
              addChild(fk); 
          }
    }
}

import flash.display.CapsStyle;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	
	
	internal class Fukidashi extends Sprite
	{	
		public function Fukidashi(str:String = "なによ!\nその言い方!\n私はただトイレットペーパーが欲しいだけなのよ!",x:Number =  250,y:Number = 250, padding:int = 10, width:int = 150, ellipse:int = 10, color:uint = 0x333333, inColor:uint = 0xeeeeee, fontSize:int = 20)
		{
			//文字.文字の長さで,高さが決まる.
			var fmt:TextFormat = new TextFormat();
			fmt.font = "_ゴシック"; //日本語フォントにすることで,MACで上が欠ける事を防止.
			fmt.size = fontSize;
			
			var tf:TextField = new TextField();
			tf.defaultTextFormat = fmt;
			tf.width = width - padding * 2;
			tf.text = str;
			tf.autoSize = TextFieldAutoSize.LEFT;
			tf.selectable = false;
			tf.wordWrap = true;
			tf.x = tf.y = padding;

			//入れ物
			var fukiContena:Sprite = new Sprite(); 
			fukiContena.x = 250 - (width/2 - padding);
			fukiContena.y = 250 - (tf.height + padding * 4);
			
			//描画
			var fuki:Shape = new Shape();
			fuki.graphics.beginFill(color, 1.0);
			fuki.graphics.drawRoundRect(0,0,width, tf.height + padding * 2 ,ellipse,ellipse);
			fuki.graphics.endFill();
			
			//中の形
			var onfuki:Shape = new Shape();
			onfuki.graphics.beginFill(inColor, 1.0);
			onfuki.graphics.drawRoundRect(0, 0, width - padding , tf.height + padding , ellipse, ellipse);
			onfuki.x = onfuki.y = padding / 2;
			
			//下の方のチョン
			var chon:Shape = new Shape();
			chon.graphics.lineStyle(padding/2, inColor, 1.0, false, "normal", CapsStyle.SQUARE);
	    	chon.graphics.moveTo(padding/2, -padding/4);
			chon.graphics.lineTo(padding/2, padding*2);
			chon.graphics.endFill();
			chon.graphics.lineStyle(padding/2, color, 1.0);
			chon.graphics.moveTo(0,0);
			chon.graphics.lineTo(padding/2, padding * 2);
			chon.graphics.lineTo(padding, 0);
			chon.graphics.endFill();
			chon.x = width / 2  - padding;
			chon.y = tf.height + padding * 2;
			
			//載せる
			addChild(fukiContena);
			fukiContena.addChild(fuki);
			fukiContena.addChild(onfuki);
			fukiContena.addChild(chon);
			fukiContena.addChild(tf);
		}
	}