1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
| //Drawing Methods Rewrite v1.5
MCP = MovieClip.prototype;
MCP.TbeginFill = MCP.beginFill;
MCP.TbeginGradientFill = MCP.beginGradientFill;
MCP.Tclear = MCP.clear;
MCP.TcurveTo = MCP.curveTo;
MCP.TendFill = MCP.endFill;
MCP.TlineStyle = MCP.lineStyle;
MCP.TlineTo = MCP.lineTo;
MCP.TmoveTo = MCP.moveTo;
MCP._xDraw = 0;
MCP._yDraw = 0;
MCP.beginFill = function(a){
this.TbeginFill(a);
this.xBeg=this._xDraw;
this.yBeg=this._yDraw;
}
MCP.beginGradientFill = function(a,b,c,d,e){
this.TbeginGradientFill(a,b,c,d,e);
this.xBeg=this._xDraw;
this.yBeg=this._yDraw;
}
MCP.clear = function(){
this.Tclear(this._xDraw=0,this._yDraw=0);
}
MCP.curveTo = function(controlX,controlY,anchorX,anchorY){
this.TcurveTo(controlX,controlY,this._xDraw=anchorX,this._yDraw=anchorY);
}
MCP.endFill = function(){
this.TendFill(this._xDraw=this.xBeg,this._yDraw=this.yBeg);
}
MCP.lineStyle = function(a,b,c,d){
if(a>=0 && !d)
this.dash=0;
else if(!d)
this.dash = 6;
else
this.dash = d;
this.TlineStyle(Math.abs(a),b,c);
}
MCP.lineTo = function(x,y){
if(!this.dash)
this.TlineTo(this._xDraw=x,this._yDraw=y);
else{
xd = x-this._xDraw;
yd = y-this._yDraw;
d = Math.sqrt(xd*xd+yd*yd)
xs = this.dash*xd/d;
ys = this.dash*yd/d;
while(Math.abs(this._xDraw-x) >= Math.abs(2*xs) && Math.abs(this._yDraw-y) >= Math.abs(2*ys)){
this.TlineTo(this._xDraw+=xs,this._yDraw+=ys);
this.TmoveTo(this._xDraw+=1*xs,this._yDraw+=1*ys);
}
this.TlineTo(this._xDraw=x,this._yDraw=y);
}
}
MCP.lineBy = function(x,y){
if(!this.dash)
this.TlineTo(this._xDraw+=x,this._yDraw+=y);
else{
xd = this._xDraw+x;
yd = this._yDraw+y;
d = Math.sqrt(x*x+y*y)
xs = this.dash*x/d;
ys = this.dash*y/d;
while(Math.abs(this._xDraw-xd) >= Math.abs(2*xs) && Math.abs(this._yDraw-yd) >= Math.abs(2*ys)){
this.TlineTo(this._xDraw+=xs,this._yDraw+=ys);
this.TmoveTo(this._xDraw+=1*xs,this._yDraw+=1*ys);
}
this.TlineTo(this._xDraw=xd,this._yDraw=yd);
}
}
MCP.moveTo = function(x,y){
this.TmoveTo(this._xDraw=x,this._yDraw=y);
}
MCP.moveBy = function(x,y){
this.TmoveTo(this._xDraw+=x,this._yDraw+=y);
}
this.lineStyle (0, 100, 100, 5) ;
this.lineTo (300, 500) ; |
Partager