In my Fourth version, I have started to my own add-on coding. I have added two arguments for the verletCloth, No of cols and no of Rows, which will change the internal construction of grid. Inside I have replaced code wherever ROWS and COLS required to follow these values. Here what I did some extra observation is COLs are coming in between the horizontal distribution of points, and ROWS are coming in between the Vertical distribution of Points. So, I made the argument scenario like this:If you want to show 10 columns, you need to pass 11 as First argument, and if you want to show 25 ROWs, you need to give 26 as second argument. After testing with different settings I am satisfied about its work and moved to the next phase. In my Fifth version, I added the Important argument Bitmapdata as first argument and pushed the other two next to it. We can retrieve a Bitmapdata in two ways. In one way, we can load external Bitmap through a Loader Object and then we can get its myImage.bitmapData, and in the other way, we can store an Image inside the Flash Library and can get it by a direct instance. I followed the second way. Inside the verletCloth object, I have made so many changes. First I have added three <Vector> arrays to Use in drawTriangles method.

`private var vertices:Vector.<Number>;          private var indices:Vector.<int>;          private var uvtData:Vector.<Number>;`

And I added another function to create the vertices, uvts and indices of Bitmapdata to be in perfect synchronization with VerletPoints created in the above defineVerlets function.

`private function defineVerletData():void{            points = new Vector.<vpoint>(COLS * ROWS, true);            sticks = new Vector.<vstick>((COLS - 1) * ROWS + (ROWS - 1) * COLS);            var i:uint = 0;            for (var r:int = 0; r < ROWS; r++) {                for (var c:int = 0; c < COLS; c++) {                    points[r * COLS + c] = new VPoint(c * COLW, r * ROWH);                    if (c > 0) {                        sticks[i++] = new VStick(points[r * COLS + c-1], points[r * COLS + c]);                    }                    if (r > 0) {                        sticks[i++] = new VStick(points[r * COLS + c], points[(r-1) * COLS + c]);                    }                }            }                    }        private function defineVertexData():void {            var j:int;            var i:int;            var indStep:int=0;            var hStep:Number=COLW;            var vStep:Number=ROWH;            vertices=new Vector.<number>();            uvtData=new Vector.<number>();            indices=new Vector.<int>();            for(j=0;j<(ROWS - 1);j++){                for(i=0;i<(COLS-1);i++){                    vertices.push(i*COLW,j*ROWH,(i+1)*COLW,j*ROWH,(i+1)*COLW,(j+1)*ROWH,i*COLW,(j+1)*ROWH);                    uvtData.push(i/(COLS-1),j/(ROWS - 1),(i+1)/(COLS-1),j/(ROWS - 1),(i+1)/(COLS-1),(j+1)/(ROWS - 1),i/(COLS-1),(j+1)/(ROWS - 1));                    indices.push(indStep,indStep+1,indStep+3,indStep+1,indStep+2,indStep+3);                    indStep+=4;                }            }        }`

Now, the init function has only three commands.Simply they will create basic GUI for the cloth simulation.

`defineVerletData();            defineVertexData();        renderGraphics();`

In Document class, I commented the startSwirl command, as I am not jumping to animate it here itself.First I want to see, whether static display is coming nice or not.Now I want to test the new Settings in the output.The Result is below:

In Sixth Version, I have removed intermediate variables like hstep and vstep.It is the carefull way to merge the two functionalities into a single function. In Seventh Version, I further trimmed the function with similar variable names for both loops and Positions.In the Most Important Eighth Version, I have finally Shifted the Vertex Positioning also into defineVerletData function. And I have created a new Important function, updateVertices. This is only a trimming of defineVerletData by removing all the other coding except loading vertices. This time I replaced the values with relevant VerletPoint x and y properties. In the enterFrame I have added updateVertices() command next to the moveVerlets() function. Now both defineVerletData and updateVertices and the enterFrame function will look like this:

`private function defineVerletData():void{            points = new Vector.<vpoint>(COLS * ROWS, true);            sticks = new Vector.<vstick>((COLS - 1) * ROWS + (ROWS - 1) * COLS);            var i:uint = 0;            var indStep:int=0;            vertices=new Vector.<number>();            uvtData=new Vector.<number>();            indices=new Vector.<int>();            for (var r:int = 0; r < ROWS; r++) {                for (var c:int = 0; c < COLS; c++) {                    points[r * COLS + c] = new VPoint(c * COLW, r * ROWH);                    if (c > 0) {                        sticks[i++] = new VStick(points[r * COLS + c-1], points[r * COLS + c]);                    }                    if (r > 0) {                        sticks[i++] = new VStick(points[r * COLS + c], points[(r-1) * COLS + c]);                    }                    if(c!=(COLS-1)){                        if(r!=(ROWS-1)){                                                    vertices.push(c*COLW,r*ROWH,(c+1)*COLW,r*ROWH,(c+1)*COLW,(r+1)*ROWH,c*COLW,(r+1)*ROWH);                            uvtData.push(c/(COLS-1),r/(ROWS - 1),(c+1)/(COLS-1),r/(ROWS - 1),(c+1)/(COLS-1),(r+1)/(ROWS - 1),c/(COLS-1),(r+1)/(ROWS - 1));                            indices.push(indStep,indStep+1,indStep+3,indStep+1,indStep+2,indStep+3);                        indStep+=4;                        }                    }                                    }            }                    }        private function updateVertices(){            vertices=new Vector.<number>();            for (var r:int = 0; r < ROWS; r++) {                for (var c:int = 0; c < COLS; c++) {                    if(c!=(COLS-1)){                        if(r!=(ROWS-1)){                                                    vertices.push(points[r * COLS + c].x,points[r * COLS + c].y,points[r * COLS + c].x+COLW,points[r * COLS + c].y,points[r * COLS + c].x+COLW,points[r * COLS + c].y+ROWH,points[r * COLS + c].x,points[r * COLS + c].y+ROWH);                        }                    }                                    }            }                    }        private function onFrame(e:Event):void {                                    moveVerlets();            updateVertices();        renderGraphics();        }`

So, I have finished all the logical steps to make the Image parts move following verletPoint animation.So, I dared to remove the comment for startSwirl command in maintimeLine and published the file. Below is the result:

Viola! The Image parts are moving. But, Horrible! They are breaking apart from their ideal positions, Why? Now, to find out my mistake, I once more observed the original code of ALEX NINO. he is processing and Using that lineTo commands based on the verletSticks. And I - in my hurry - followed VerletPoints to updateVertices. Now, I need to update the vertices according to the sticks. You need to look at the First Code snippet to follow what ALEX did to define sticks. He started from second row and in each row from second column to define sticks to start from its previous point to current point. That too, there are two types of sticks on each point:one vertical and one horizontal. In fact I have covered all these eight steps very fastly, witin hours! But, this part seems to be very difficult to me.It took complete two days to solve this riddle. I also want to follow the same sequence as I already wrote updateVertices in a nice way. what correction I needed to make it asuccess is to replace the points[ (r*COLS+c)] with horizontal line which starts at current 'c' of innner loop and previous row horizontal line which starts at the same 'c' value. But it is not a straight forward value to retrieve from the loop position (r*COLS+c). At first I thought of naming the horizontal lines in the defineVerletData as hStick0, hStick1 etc. and here I just run a single for loop of all the hSticks number variable. But It is missing some of the points. I put a blind rule to find a solution by retrieving current and previous hLines within the framework of current updateVertices function. So, I plucked all the Quartet generating code into a separate file and worked out with debugging traces.

All that I could follow is this: getting the current position horizontal line is very easy- reduce Total vertical Lines drawn upto this point from total lines drawn upto this point. That will give the coorect Index in sticks array to get its pointa and pointb from this parameters from four to eight will be filled. Then what about previous horizontal line to fill the first four parameters? that you cannot derive directly.But you can deduct a set of total lines for a row from the current horizontal line index. Again You need to deduct number of right side columns of current 'c' value. After understanding that the deductions are correct I jumped upto my Nineth Version, which in turn gave the correct animation.I just replaced the updateVertices from that practice file to working file.