_root.draw_region.onEnterFrame = function() { //Upon entering frame, check list of objects being drawn for(i = 0; i < _root.currentDrawList.length()-1; i++) { //Since user could have drawn while this was drawing //Check how many, if any points need to be drawn this frame //Automatically need to draw if sinceLast = -1 if(_root.currentDrawList[i].sinceLast == -1 || _root.currentDrawList[i].sinceLast == _root.currentDrawList[i].frameInterval) { //Reset counter _root.currentDrawList[i].sinceLast = 1; //Now draw "points per frame" worth of points, or points left if there are less points left than ppf. //How many points left? var points_left = _root.currentDrawList[i].coords.length() - 1 - _root.currentDrawList[i].lastIndex; if(points_left >= _root.currentDrawList[i].ppf) { //Move to the last point point line.moveTo(_root.currentDrawList[i].coords[i_root.currentDrawList[i].lastIndex]); for(x = _root.currentDrawList[i].lastIndex + 1; x < _root.currentDrawList[i].lastIndex + 1 + _root.currentDrawList[i].ppf; x++) { line.lineTo(_root.currentDrawList[i].coords[x]); } } else { //Draw remaining points line.moveTo(_root.currentDrawList[i].coords[i_root.currentDrawList[i].lastIndex]); for(x = _root.currentDrawList[i].lastIndex + 1; x < _root.currentDrawList[i].lastIndex + 1 + pointsleft; x++) { line.lineTo(_root.currentDrawList[i].coords[x]); } } //Set the last index _root.currentDrawList[i].lastIndex = x; //Check if it needs to be removed from list if(_root.currentDrawList[i].coords.length - 1 == _root.currentDrawList[i].coords[i_root.currentDrawList[i].lastIndex] } gotoAndPlay(2); }