< Day Day Up > |
Availability Flash MX 2004. Description A ToolObj object represents an individual tool in the Tools panel. To access a ToolObj object, use properties of the Tools object: either the tools.toolObjs array or tools.activeTool. Method summary for the ToolObj objectThe following methods are available for the ToolObj object. Note The following methods are used only when creating extensible tools.
Property summary for the ToolObj objectThe following property is available for the ToolObj object:
toolObj.depthAvailability Flash MX 2004. Usage toolObj.depth Description Read-only property; an integer that specifies the depth of the tool in the pop-up menu in the Tools panel. This property is used only when creating extensible tools. Example The following example specifies that the tool has a depth of 1, which means one level under a tool in the Tools panel. fl.tools.activeTool.depth = 1; toolObj.enablePIControl()Availability Flash MX 2004. Usage toolObj.enablePIControl( control, bEnable ) Parameters control A string that specifies the name of the control to enable or disable. Legal values depend on the Property inspector invoked by this tool (see toolObj.setPI()). A shape Property inspector has the following controls:
A text Property inspector has the following controls:
A movie Property inspector has the following controls:
bEnable A Boolean value that determines whether to enable (true) or disable (false) the control. Returns Nothing. Description Method; enables or disables the specified control in a Property inspector. Used only when creating extensible tools. Example The following command in an extensible tool's JavaScript file will set Flash to not show the stroke options in the Property inspector for that tool: theTool.enablePIControl( "stroke", false); toolObj.iconIDAvailability Flash MX 2004. Usage toolObj.iconID Description Read-only property; an integer with a value of -1. This property is used only when you create extensible tools. An iconID value of -1 means that Flash will not try find an icon for the tool. Instead, the script for the tool should specify the icon to display in the Tools panel; see toolObj.setIcon(). Example The following example assigns a value of -1 (the icon ID of the current tool) to the toolIconID variable: var toolIconID = fl.tools.activeTool.iconID toolObj.positionAvailability Flash MX 2004. Usage toolObj.position Description Read-only property; an integer that specifies the position of the tool in the Tools panel. This property is used only when you create extensible tools. Example The following commands in the mouseDown() method of a tool's JavaScript file will show that tool's position in the Tools panel as an integer in the Output panel: myToolPos = fl.tools.activeTool.position; fl.trace(myToolPos); toolObj.setIcon()Availability Flash MX 2004. Usage toolObj.setIcon( file ) Parameters file A string that specifies the name of the PNG file to use as the icon. The PNG file must be placed in the same folder as the JSFL file. Returns Nothing. Description Method; identifies a PNG file to use as a tool icon in the Tools panel. This method is used only when you create extensible tools. Example The following example specifies that the image in the PolyStar.png file should be used as the icon for the tool named PolyStar. This code is taken from the sample PolyStar.jsfl file (see "Sample PolyStar tool" on page 20): theTool = fl.tools.activeTool; theTool.setIcon("PolyStar.png"); toolObj.setMenuString()Availability Flash MX 2004. Usage toolObj.setMenuString( menuStr ) Parameters menuStr A string that specifies the name that appears in the pop-up menu as the name for the tool. Returns Nothing. Description Method; sets the string that appears in the pop-up menu as the name for the tool. This method is used only when you create extensible tools. Example The following example specifies that the tool named theTool should display the name "PolyStar Tool" in its pop-up menu. This code is taken from the sample PolyStar.jsfl file (see "Sample PolyStar tool" on page 20): theTool = fl.tools.activeTool; theTool.setMenuString("PolyStar Tool"); toolObj.setOptionsFile()Availability Flash MX 2004. Usage toolObj.setOptionsFile( xmlFile ) Parameters xmlFile A string that specifies the name of the XML file that has the description of the tool's options. The XML file must be placed in the same folder as the JSFL file. Returns Nothing. Description Method; associates an XML file with the tool. The file specifies the options to appear in a modal panel that is invoked by an Options button in the Property inspector. You would usually use this method in the configureTool() function inside your JSFL file. See configureTool(). For example, the PolyStar.xml file specifies three options associated with the Polygon tool: <properties> <property name="Style" variable="style" list="polygon,star" defaultValue="0" type="Strings" /> <property name="Number of Sides" variable="nsides" min="3" max="32" defaultValue="5" type="Number" /> <property name="Star point size" variable="pointParam" min="0" max="1" defaultValue=".5" type="Double" /> </properties> Example The following example specifies that the file named PolyStar.xml is associated with the currently active tool. This code is taken from the sample PolyStar.jsfl file (see "Sample PolyStar tool" on page 20): theTool = fl.tools.activeTool; theTool.setOptionsFile( "PolyStar.xml" ); toolObj.setPI()Availability Flash MX 2004. Usage toolObj.setPI( pi ) Parameters pi A string that specifies the Property inspector to invoke for this tool. Returns Nothing. Description Method; specifies which Property inspector should be used when the tool is activated. This method is used only when you create extensible tools. Acceptable values are "shape" (the default), "text", and "movie". Example The following example specifies that the shape Property inspector should be used when the tool is activated. This code is taken from the sample PolyStar.jsfl file (see "Sample PolyStar tool" on page 20): theTool = fl.tools.activeTool; theTool.setPI( "shape" ); toolObj.setToolName()Availability Flash MX 2004. Usage toolObj.setToolName( name ) Parameters name A string that specifies the name of the tool. Returns Nothing. Description Method; assigns a name to the tool for the configuration of the Tools panel. This method is used only when you create extensible tools. The name is used only by the XML layout file that Flash reads to construct the Tools panel. The name does not appear in the Flash user interface. Example The following example assigns the name "polystar" to the tool named theTool. This code is taken from the sample PolyStar.jsfl file (see "Sample PolyStar tool" on page 20): theTool = fl.tools.activeTool; theTool.setToolName("polystar"); toolObj.setToolTip()Availability Flash MX 2004. Usage toolObj.setToolTip( toolTip ) Parameters toolTip A string that specifies the tooltip to use for the tool. Returns Nothing. Description Method; sets the tooltip that appears when the mouse is held over the tool icon. This method is used only when you create extensible tools. Example The following example specifies that the tooltip for the tool should be "PolyStar Tool." This code is taken from the sample PolyStar.jsfl file (see "Sample PolyStar tool" on page 20): theTool = fl.tools.activeTool; theTool.setToolTip("PolyStar Tool"); toolObj.showPIControl()Availability Flash MX 2004. Usage toolObj.showPIControl( control, bShow ) Parameters control A string that specifies the name of the control to show or hide. This method is used only when you create extensible tools. Valid values depend on the Property inspector invoked by this tool (see toolObj.setPI()). A shape Property inspector has the following controls:
A text Property inspector has the following controls:
The movie Property inspector has the following controls:
bShow A Boolean value that determines whether to show or hide the specified control (TRue shows the control; false hides the control). Returns Nothing. Description Method; shows or hides a control in the Property inspector. This method is used only when you create extensible tools. Example The following command in an extensible tool's JavaScript file will set Flash to not show the fill options in the Property inspector for that tool: fl.tools.activeTool.showPIControl( "fill", false ); toolObj.showTransformHandles()Availability Flash MX 2004. Usage toolObj.showTransformHandles( bShow ) Parameters bShow A Boolean value that determines whether to show or hide the free transform handles for the current tool (true shows the handles; false hides them). Returns Nothing. Description Method; called in the configureTool() method of an extensible tool's JavaScript file to indicate that the free transform handles should appear when the tool is active. This method is used only when you create extensible tools. Example See configureTool(). |
< Day Day Up > |