drawing_api_core_extensions.as

来自「这是《Flash MX编程与创意实现》的源代码」· AS 代码 · 共 69 行

AS
69
字号
/*
  Extensions for Core Drawing API v1.1
  Oct. 29, 2002
  (c) 2002 Robert Penner
  
  These methods override and wrap around specific
  MovieClip drawing methods in order to store the
  coordinates of the drawing pen.
  
  Include this code and use the drawing API as normal.
  Use the _xpen and _ypen properties of a movie clip to
  retrieve its drawing pen coordinates. 
  Use the _xpenStart and _ypenStart properties to 
  retrieve the coordinates of the pen's current subpath.
  
  Dependencies: ASSetPropFlags (undocumented feature of Flash 5+)
  
  Discussed in Chapter 10 of 
  Robert Penner's Programming Macromedia Flash MX
  
  http://www.robertpenner.com/profmx
  http://www.amazon.com/exec/obidos/ASIN/0072223561/robertpennerc-20
*/


var MCP = MovieClip.prototype;

MCP.f6moveTo = MCP.moveTo;
MCP.moveTo = function (x, y) {
	with (this) {
		f6moveTo (x, y);
		_xpen = _xpenStart = x;
		_ypen = _ypenStart = y;
	}
};

MCP.f6lineTo = MCP.lineTo;
MCP.lineTo = function (x, y) {
	with (this) {
		f6lineTo (x, y);
		_xpen = x;
		_ypen = y;
	}
};

MCP.f6curveTo = MCP.curveTo;
MCP.curveTo = function (cx, cy, ax, ay) {
	with (this) {
		f6curveTo (cx, cy, ax, ay);
		_xpen = ax;
		_ypen = ay;
	}
};

MCP.f6clear = MCP.clear;
MCP.clear = function () {
    with (this) {
        f6clear();
        _xpen = _ypen = _xpenStart = _ypenStart = 0;
    }
};


MCP._xpen = MCP._ypen = MCP._xpenStart = MCP._ypenStart = 0;
ASSetPropFlags (MCP, null, 1);



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?