forked from: flash on 2010-1-2
forked from flash on 2010-1-2 (diff: 49)
ActionScript3 source code
/**
* Copyright foo9 ( http://wonderfl.net/user/foo9 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/HaMA
*/
// forked from foo9's flash on 2010-1-2
package
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.geom.Rectangle;
public class FlashTest extends Sprite
{
public static const SAMPLE_TEXT:String = (
<![CDATA[A★ああああああ
○ああああああ
●ああああああ
◎ああああああ
□ああああああ
■ああああああ
◇ああああああ
◆ああああああ]]>);
private var textField:TextField;
public function FlashTest()
{
textField = new TextField();
addChild(textField);
textField.text = SAMPLE_TEXT;
textField.x = 5;
textField.y = 5;
textField.width = 200;
textField.height = 200;
textField.background = true;
textField.backgroundColor = 0xCCCCCC;
textField.border = true;
textField.borderColor = 0x0000FF;
//関係なくなるみたい
textField.multiline = false;
var sp:Sprite = new Sprite();
sp.graphics.lineStyle(1,0xFF0000);
var rect:Rectangle = textField.getCharBoundaries(0);
//var rect:Rectangle = textField.getBounds(this);
//var rect:Rectangle = textField.getBounds(textField);
//var rect:Rectangle = textField.getRect(this);
//var rect:Rectangle = textField.getRect(textField);
rect.offset(textField.x, textField.y);
sp.graphics.drawRect(rect.x, rect.y, rect.width, rect.height);
addChild(sp);
}
}
}
