flash on 2013-3-28
♥0 |
Line 77 |
Modified 2013-03-28 04:20:23 |
MIT License
archived:2017-03-20 11:44:37
ActionScript3 source code
/**
* Copyright hemingway ( http://wonderfl.net/user/hemingway )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/3mCEf
*/
package
{
import flash.display.*;
import flash.system.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
[SWF(frameRate = 60, width = 1024, height = 768)]
public class FlashTest extends Sprite
{
public function FlashTest()
{
stage.scaleMode = StageScaleMode.SHOW_ALL;
addEventListener(Event.ADDED_TO_STAGE, addedToStage);
}
public function addedToStage($e:*) :void
{
removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
init();
}
public function init() :void
{
graphics.clear();
graphics.lineStyle(1);
graphics.drawRect(0, 0, 1023, 767);
}
}
}
import flash.display.*;
import flash.system.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
class Buffer extends Sprite
{
}
class Output extends TextField
{
private var textFormat :TextFormat;
protected var _x :Number;
protected var _y :Number;
protected var _font :String;
protected var _content :String;
public function Output($content:String, $x:Number = 1, $y:Number = 0, $font:String = "Helvetica")
{
addEventListener(Event.ADDED_TO_STAGE, addedToStage);
_x = $x;
_y = $y;
_font = $font;
_content = $content;
multiline = true;
autoSize = "left";
selectable = mouseEnabled = false;
antiAliasType = AntiAliasType.ADVANCED;
}
public function _init() :void
{
x = _x;
y = _y;
text = _content;
textFormat = new TextFormat(_font);
setTextFormat(textFormat);
}
public function addedToStage($e:Event) :void
{
removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
_init();
}
public function get font() :String
{ return _font }
public function get nWidth() :Number
{ return width }
public function set font($:String) :void
{ _font = $; _init() }
public function set content($:String) :void
{ _content = $; _init() }
}