Well that seemed to kind of get me closer, here is the latest example using your code tip (pasted below)
http://www.ashbrand.com/curveto_circle_2.swf Thank you. /*--------------------------------------------------------------------*/ this.pLine.beginFill (0xF0A0B9); var endX:Number, endY:Number; var thisPoint:MovieClip; var nextPoint:MovieClip; this.pLine.moveTo (0,100); for (var i:Number = 0; i < this.controlPoints.length; i++) { thisPoint = this.controlPoints[i]; nextPoint = this.controlPoints[(i + 1) % controlPoints.length]; endX = (thisPoint._x + nextPoint._x) / 2; endY = (thisPoint._y + nextPoint._y) / 2; this.pLine.curveTo (thisPoint._x, thisPoint._y, endX, endY); } this.pLine.endFill (); /*--------------------------------------------------------------------*/ -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hans Wichman Sent: Tuesday, July 17, 2007 2:55 PM To: [email protected] Subject: Re: [Flashcoders] Drawing API :: curveTo assistance, code and example inside Hi, my quick guess is, let the loop run from 0 to i < controlPoints.length and do the lookup like this.controlPoints[ (i+1)%controlPoints.length ] Just a guess though, but I think that might be it. And then skip the last curveTo outside of the loop. greetz JC On 7/17/07, Ash Warren <[EMAIL PROTECTED]> wrote: > > This might be a better example: > > http://www.ashbrand.com/curveto_circle.swf > > I am using basically the same code however, please see below: > > /*--------------------------------------------------------------------*/ > this.pLine.beginFill (0xF0A0B9); > var endX:Number, endY:Number; > var thisPoint:MovieClip; > var nextPoint:MovieClip; > this.pLine.moveTo (0,100); > > for (var i:Number = 0; i < this.controlPoints.length - 1; i++) > { > thisPoint = this.controlPoints[i]; > nextPoint = this.controlPoints[i + 1]; > endX = (thisPoint._x + nextPoint._x) / 2; > endY = (thisPoint._y + nextPoint._y) / 2; > this.pLine.curveTo (thisPoint._x, thisPoint._y, endX, > endY); > } > > var lastPoint:MovieClip = > this.controlPoints[this.controlPoints.length - 1]; > this.pLine.curveTo (lastPoint._x,lastPoint._y, 0, 100); > > this.pLine.endFill (); > /*--------------------------------------------------------------------*/ > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Ash Warren > Sent: Tuesday, July 17, 2007 1:44 PM > To: [email protected] > Subject: [Flashcoders] Drawing API :: curveTo assistance, code and example > inside > > I am trying to create a very simple way for a user to manipulate a mask > shape in Flash using curveTo. > > After finding a few great online examples I feel that I'm getting pretty > close, however I cannot get rid of my "corner" control point that > begins/ends the shape. > > Please view the example here and click on the top center point to see what > I > mean, it manipulates the shape at more of a "right" angle instead of a > nice > subtle curve like the others. > > http://www.ashbrand.com/curveto.swf > > The code that I am using is posted below (where "controlPoints" is simply > an > array holding the x and y values for those points and "p1" is the actual > mc > on the stage that acts as the start/end of the shape). > > I feel like such a newb when it comes to beziers and the drawing API in > Flash. Thank you in advance for any assistance. > > /*--------------------------------------------------------------------*/ > this.pLine.beginFill (0xF0A0B9); > > var startX:Number = this.p1._x; > var startY:Number = this.p1._y; > var endX:Number, endY:Number; > var thisPoint:MovieClip; > var nextPoint:MovieClip; > this.pLine.moveTo (startX,startY); > > for (var i:Number = 0; i < this.controlPoints.length - 1; i++) > { > thisPoint = this.controlPoints[i]; > nextPoint = this.controlPoints[i + 1]; > endX = (thisPoint._x + nextPoint._x) / 2; > endY = (thisPoint._y + nextPoint._y) / 2; > this.pLine.curveTo (thisPoint._x, thisPoint._y, endX, > endY); > > startX = endX; > startY = endY; > } > > var lastPoint:MovieClip = > this.controlPoints[this.controlPoints.length - 1]; > this.pLine.curveTo (lastPoint._x,lastPoint._y, this.p1._x, > this.p1._y); > > this.pLine.endFill (); > /*--------------------------------------------------------------------*/ > > _______________________________________________ > [email protected] > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > > _______________________________________________ > [email protected] > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

