ࡱ> Root Entryp|YrRASHpS ContentsPage 1  "&'Root Entryp|YrRASHpԍZ@ Contents Page 1  !#$%  !"#$%&'()*+,-./01234CPicPage CPicLayer CPicFrame?~ /* * Method: TextField.appendText * Desc: A convenient method for adding text to a * text field without disturbing its formatting. Each cell in the * table can not wrap, so text must not exceed each tab stop. * Params: theText The text to add. */ TextField.prototype.appendText = function (theText) { // Remember the original scroll because replaceSel // can change scroll. var origScroll = this.scroll; // Focus the field. Selection.setFocus(this); // Position insertion point after the last character. Selection.setSelection(this.length, this.length); // Add the text to the field. this.replaceSel(theText); // Reset the scroll to where it was before we // added any text. this.scroll = origScroll; } /* * Method: TextField.makeTable * Desc: Formats an array of text as a table. * Params: tabStops Array containing the positions of the columns, * starting with column 2, not column 1. * data The array to format. */ TextField.prototype.makeTable = function (tabstops, data) { // Store the tab character in a variable. var tab = "\t"; // Calculate number of columns. var numCols = tabstops.length; // Calculate number of rows. var numRows = Math.ceil(data.length/numCols); // Initialize our text variable that will eventually // be assigned to the field. var newText = ""; // Now we just need to add tab characters between each // column, and newline characters after each row. // For each row... for (var i = 0; i < numRows; i++) { // ...cycle through each column. for (var j = 0; j < numCols; j++) { // Add each item in the array to our text. newText += data[i*numCols + j]; // If we're done with all the elements in the array, // quit the loop. if (i*numCols + j == data.length - 1) { break; } // If we're not on the last column... if (j < numCols - 1) { // ...add a Tab character. newText += tab; } else { // ...otherwise add a newline character. newText += "\n" } } } // Finally, we have to apply the tab stops using a // TextFormat object. Make the text format object, // but keep the old tabStops property around so // we can put it back when we're done. format = this.getNewTextFormat(); var oldTabStops = format.tabStops; format.tabStops = tabstops; // Apply the tab stops. this.setNewTextFormat(format); // Insert our table. this.appendText("\n" + newText + "\n"); // Restore the original tab stops. format.tabStops = oldTabStops; this.setNewTextFormat(format); } // Example use. Create an array that will become a table. var tableData = ["one", "two", "three", "four", "five", "six", "seven"]; // Create a text field to hold the table. this.createTextField("theField_txt", 1, 0, 0, 250, 60); theField_txt.border = true; // Add some text and the table. theField_txt.appendText("Here is the table:"); theField_txt.makeTable([50, 125, 200], tableData); theField_txt.appendText("Isn't it pretty?");  Layer 1Ok; } if (j < numCols - 1) { trace("next item"); newText += tab; } else { newText += "\n" } } } // Make the text format object, but keep the old // tabStops property around so we can put it ba) CDocumentPagePage 1Scene 1]<=*@hhhhh  CColorDef3PfP0PHP`Px333(3f<03CH3F`3Hxf0f30ff(0f5Hf<`f@x3330333xf3d03]H3Z`3Xx3333303f3PPH33Px`33Px33Pf30f33PHff3(PHf3<x`f3Cxf3Ffff`f03f0ffx0fkHfd`f`x3f033fPH3ffxPH3fdx`3f]x3fZff0f3fPHfff`ffP0xffPxffPH3HfHxH̙n`hx3H33x`3fx`3xx`3̙kx3dfHf3x`ff0xfx0xf̙dxf]`3`f``x`px3`33x3fx3x3xx3nf`f3xffxfxfxxfkx3xfxxxxx3x333f333xfxf3fffffxxH3 HfH(H2`8x`3 `f`̙`(`0xx3xfxx x(xPx3H33x`f3x`3(x`35x3<3`33xf3 x̙3x3(x323x33f3 333(xfH3fx`ff0xf(0xf<xfCf`3fxffx̙fxf(xf5f  !"#$%&'()*+,-./0123CPicPage CPicLayer CPicFrame?$ /* * Method: TextField.addText * Desc: A convenient method for adding text to a * text field without disturbing its formatting. Each cell in the * table can not wrap, so text must not exceed each tab stop. * Params: theText The text to add. */ TextField.prototype.addText = function (theText) { // Remember the original scroll because replaceSel // can change scroll. var origScroll = this.scroll; // Focus the field. Selection.setFocus(this); // Position insertion point after the last character. Selection.setSelection(this.length, this.length); // Add the text to the field. this.replaceSel(theText); // Reset the scroll to where it was before we // added any text. this.scroll = origScroll; } /* * Method: TextField.makeTable * Desc: Formats an array of text as a table. * Params: tabStops Array containing the positions of the columns, * starting with column 2, not column 1. * data The array to format. */ TextField.prototype.makeTable = function (tabstops, data) { // Store the tab character in a variable. var tab = "\t"; // Calculate number of columns. var numCols = tabstops.length; // Calculate number of rows. var numRows = Math.ceil(data.length/numCols); // Initialize our text variable that will eventually // be assigned to the field. var newText = ""; // Now we just need to add tab characters between each // column, and newline characters after each row. // For each row... for (var i = 0; i < numRows; i++) { // ...cycle through each column. for (var j = 0; j < numCols; j++) { // Add each item in the array to our text. newText += data[i*numCols + j]; // If we're done with all the elements in the array, // quit the loop. if (i*numCols + j == data.length - 1) { break; } // If we're not on the last column... if (j < numCols - 1) { // ...add a Tab character. newText += tab; } else { // ...otherwise add a newline character. newText += "\n" } } } // Finally, we have to apply the tab stops using a // TextFormat object. Make the text format object, // but keep the old tabStops property around so // we can put it back when we're done. format = this.getNewTextFormat(); var oldTabStops = format.tabStops; format.tabStops = tabstops; // Apply the tab stops. this.setNewTextFormat(format); // Insert our table. this.addText("\n" + newText + "\n"); // Restore the original tab stops. format.tabStops = oldTabStops; this.setNewTextFormat(format); } // Example use. Create an array that will become a table. var tableData = ["one", "two", "three", "four", "five", "six", "seven"]; // Create a text field to hold the table. this.createTextField("theField_txt", 1, 0, 0, 250, 60); theField_txt.border = true; // Add some text and the table. theField_txt.addText("Here is the table:"); theField_txt.makeTable([50, 125, 200], tableData); theField_txt.addText("Isn't it pretty?");  Layer 1O { break; } if (j < numCols - 1) { trace("next item"); newText += tab; } else { newText += "\n" } } } // Make the text format object, but keep the old // tabStops property around so we can put it ba) CDocumentPagePage 1Scene 1]<@<*@hhhhh  CColorDef3PfP0PHP`Px333(3f<03CH3F`3Hxf0f30ff(0f5Hf<`f@x3330333xf3d03]H3Z`3Xx3333303f3PPH33Px`33Px33Pf30f33PHff3(PHf3<x`f3Cxf3Ffff`f03f0ffx0fkHfd`f`x3f033fPH3ffxPH3fdx`3f]x3fZff0f3fPHfff`ffP0xffPxffPH3HfHxH̙n`hx3H33x`3fx`3xx`3̙kx3dfHf3x`ff0xfx0xf̙dxf]`3`f``x`px3`33x3fx3x3xx3nf`f3xffxfxfxxfkx3xfxxxxx3x333f333xfxf3fffffxxH3 HfH(H2`8x`3 `f`̙`(`0xx3xfxx x(xPx3H33x`f3x`3(x`35x3<3`33xf3 x̙3x3(x323x33f3 333(xfH3fx`ff0xf(0xf<xfCf`3fxffx̙fxf(xf5fx3ffff ff((xH3x`f0x̙PPP`3xfx̙P̙(P<x3f̙(xx`3xfxPxx3ffff ff((xH3x`f0x̙PPP`3xfx̙P̙(P<x3f̙(xx`3xfxPxPd`3xfx̙PPx3f(xx3fxx3f̙xx3fPd`3xfx̙PPx3f(xx3fxx3f̙xx3ff`zf*]arial<LArial"(<arialh