Document object

Availability

Flash MX 2004.

Description

The Document object represents the Stage. That is, only FLA files are considered documents. To return the Document object for the current document, use fl.getDocumentDOM().

Method summary

You can use the following methods with the Document object:

Method

Description

document.addDataToDocument()

Stores specified data with a document.

document.addDataToSelection()

Stores specified data with the selected object(s).

document.addFilter()

Applies a filter to the selected objects.

document.addItem()

Adds an item from any open document or library to the specified Document object.

document.addNewLine()

Adds a new path between two points.

document.addNewOval()

Adds a new Oval object in the specified bounding rectangle.

document.addNewPrimitiveOval()

Adds a new oval primitive fitting into the specified bounds.

document.addNewPrimitiveRectangle()

Adds a new rectangle primitive fitting into the specified bounds.

document.addNewPublishProfile()

Adds a new publish profile and makes it the current one.

document.addNewRectangle()

Adds a new rectangle or rounded rectangle, fitting it into the specified bounds.

document.addNewScene()

Adds a new scene (Timeline object) as the next scene after the currently selected scene and makes the new scene the currently selected scene.

document.addNewText()

Inserts a new empty text field.

document.align()

Aligns the selection.

document.allowScreens()

Use this method before using the document.screenOutline property.

document.arrange()

Arranges the selection on the Stage.

document.breakApart()

Performs a break-apart operation on the current selection.

document.canEditSymbol()

Indicates whether the Edit Symbols menu and functionality are enabled.

document.canRevert()

Determines whether you can use the document.revert() or fl.revertDocument() method successfully.

document.canSaveAVersion()

Determines whether a version of the specified document can be saved to the Version Cue server.

document.canTestMovie()

Determines whether you can use the document.testMovie() method successfully.

document.canTestScene()

Determines whether you can use the document.testScene() method successfully.

document.changeFilterOrder()

Changes the index of the filter in the Filters list.

document.clipCopy()

Copies the current selection from the document to the Clipboard.

document.clipCut()

Cuts the current selection from the document and writes it to the Clipboard.

document.clipPaste()

Pastes the contents of the Clipboard into the document.

document.close()

Closes the specified document.

document.convertLinesToFills()

Converts lines to fills on the selected objects.

document.convertToSymbol()

Converts the selected Stage item(s) to a new symbol.

document.crop()

Uses the top selected drawing object to crop all selected drawing objects underneath it.

document.deleteEnvelope()

Deletes the envelope (bounding box that contains one or more objects) from the selected object.

document.deletePublishProfile()

Deletes the currently active profile, if there is more than one.

document.deleteScene()

Deletes the current scene (Timeline object), and if the deleted scene was not the last one, sets the next scene as the current Timeline object.

document.deleteSelection()

Deletes the current selection on the Stage.

document.disableAllFilters()

Disables all filters on the selected objects.

document.disableFilter()

Disables the specified filter in the Filters list.

document.disableOtherFilters()

Disables all filters except the one at the specified position in the Filters list.

document.distribute()

Distributes the selection.

document.distributeToLayers()

Performs a distribute-to-layers operation on the current selection; equivalent to selecting Distribute to Layers.

document.documentHasData()

Checks the document for persistent data with the specified name.

document.duplicatePublishProfile()

Duplicates the currently active profile and gives the duplicate version focus.

document.duplicateScene()

Makes a copy of the currently selected scene, giving the new scene a unique name and making it the current scene.

document.duplicateSelection()

Duplicates the selection on the Stage.

document.editScene()

Makes the specified scene the currently selected scene for editing.

document.enableAllFilters()

Enables all the filters on the Filters list for the selected object(s).

document.enableFilter()

Enables the specified filter for the selected object(s).

document.enterEditMode()

Switches the authoring tool into the editing mode specified by the parameter.

document.exitEditMode()

Exits from symbol-editing mode and returns focus to the next level up from the editing mode.

document.exportPNG()

Exports the document as one or more PNG files.

document.exportPublishProfile()

Exports the currently active profile to an XML file.

document.exportPublishProfileString()

Returns a string that specifies, in XML format, the specified profile.

document.exportSWF()

Exports the document in the Flash SWF format.

document.getAlignToDocument()

Identical to retrieving the value of the To Stage button in the Align panel.

document.getBlendMode()

Returns a string that specifies the blending mode for the selected object(s).

document.getCustomFill()

Retrieves the fill object of the selected shape, or the Tools panel and Property inspector if specified.

document.getCustomStroke()

Returns the stroke object of the selected shape, or the Tools panel and Property inspector if specified.

document.getDataFromDocument()

Retrieves the value of the specified data.

document.getElementProperty()

Gets the specified Element property for the current selection.

document.getElementTextAttr()

Gets a specified TextAttrs property of the selected Text objects.

document.getFilters()

Returns an array that contains the list of filters applied to the currently selected object(s).

document.getMetadata()

Returns a string containing the XML metadata associated with the document.

document.getMobileSettings()

Returns the string passed to document.setMobileSettings().

document.getPlayerVersion()

Returns a string that represents the targeted player version for the specified document.

document.getSelectionRect()

Gets the bounding rectangle of the current selection.

document.getTextString()

Gets the currently selected text.

document.getTimeline()

Retrieves the current Timeline object in the document.

document.getTransformationPoint()

Gets the location of the transformation point of the current selection.

document.group()

Converts the current selection to a group.

document.importFile()

Imports a file into the document.

document.importPublishProfile()

Imports a profile from a file.

document.importPublishProfileString()

Imports an XML string that represents a publish profile and sets it as the current profile.

document.importSWF()

Imports a SWF file into the document.

document.intersect()

Creates an intersection drawing object from all selected drawing objects.

document.match()

Makes the size of the selected objects the same.

document.mouseClick()

Performs a mouse click from the Selection tool.

document.mouseDblClk()

Performs a double mouse click from the Selection tool.

document.moveSelectedBezierPointsBy()

If the selection contains at least one path with at least one Bézier point selected, this method moves all selected Bézier points on all selected paths by the specified amount.

document.moveSelectionBy()

Moves selected objects by a specified distance.

document.optimizeCurves()

Optimizes smoothing for the current selection, allowing multiple passes, if specified, for optimal smoothing; equivalent to selecting Modify > Shape > Optimize.

document.publish()

Publishes the document according to the active publish settings (File > Publish Settings); equivalent to selecting File > Publish.

document.punch()

Uses the top selected drawing object to punch through all selected drawing objects underneath it.

document.removeAllFilters()

Removes all filters from the selected object(s).

document.removeDataFromDocument()

Removes persistent data with the specified name that has been attached to the document.

document.removeDataFromSelection()

Removes persistent data with the specified name that has been attached to the selection.

document.removeFilter()

Removes the specified filter from the Filters list of the selected object(s).

document.renamePublishProfile()

Renames the current profile.

document.renameScene()

Renames the currently selected scene in the Scenes panel.

document.reorderScene()

Moves the specified scene before another specified scene.

document.resetOvalObject()

Sets all values in the Property inspector to default Oval object settings.

document.resetRectangleObject()

Sets all values in the Property inspector to default Rectangle object settings.

document.resetTransformation()

Resets the transformation matrix; equivalent to selecting Modify > Transform > Remove Transform.

document.revert()

Reverts the specified document to its previously saved version; equivalent to selecting File > Revert.

document.revertToLastVersion()

Reverts the specified document to the version stored on the Version Cue server and logs any errors to the Output panel.

document.rotate3DSelection()

Applies a 3D rotation to the selection.

document.rotateSelection()

Rotates the selection by a specified number of degrees.

document.save()

Saves the document in its default location; equivalent to selecting File > Save.

document.saveAndCompact()

Saves and compacts the file; equivalent to selecting File > Save and Compact.

document.saveAVersion()

Saves a version of the specified document to the Version Cue server.

document.scaleSelection()

Scales the selection by a specified amount; equivalent to using the Free Transform tool to scale the object.

document.selectAll()

Selects all items on the Stage; equivalent to pressing Control+A (Windows) or Command+A (Macintosh) or selecting Edit > Select All.

document.selectNone()

Deselects any selected items.

document.setAlignToDocument()

Sets the preferences for document.align(), document.distribute(), document.match(), and document.space() to act on the document; equivalent to enabling the To Stage button in the Align panel.

document.setBlendMode()

Sets the blending mode for the selected objects.

document.setCustomFill()

Sets the fill settings for the Tools panel, Property inspector, and any selected shapes.

document.setCustomStroke()

Sets the stroke settings for the Tools panel, Property inspector, and any selected shapes.

document.setElementProperty()

Sets the specified Element property on selected object(s) in the document.

document.setElementTextAttr()

Sets the specified TextAttrs property of the selected text items to the specified value.

document.setFillColor()

Changes the fill color of the selection to the specified color.

document.setFilterProperty()

Sets a specified filter property for the currently selected object(s).

document.setFilters()

Applies filters to the selected objects.

document.setInstanceAlpha()

Sets the opacity of the instance.

document.setInstanceBrightness()

Sets the brightness for the instance.

document.setInstanceTint()

Sets the tint for the instance.

document.setMetadata()

Sets the XML metadata for the specified document, overwriting any existing metadata.

document.setMobileSettings()

Sets the value of an XML settings string in a mobile FLA file.

document.setOvalObjectProperty()

Specifies a value for a specified property of primitive Oval objects.

document.setPlayerVersion()

Sets the version of the Flash Player targeted by the specified document.

document.setRectangleObjectProperty()

Specifies a value for a specified property of primitive Rectangle objects.

document.setSelectionBounds()

Moves and resizes the selection in a single operation.

document.setSelectionRect()

Draws a rectangular selection marquee relative to the Stage, using the specified coordinates.

document.setStageVanishingPoint()

Specifies the vanishing point for viewing 3D objects.

document.setStageViewAngle()

Specifies the perspective angle for viewing 3D objects.

document.setStroke()

Sets the color, width, and style of the selected strokes.

document.setStrokeColor()

Changes the stroke color of the selection to the specified color.

document.setStrokeSize()

Changes the stroke size of the selection to the specified size.

document.setStrokeStyle()

Changes the stroke style of the selection to the specified style.

document.setTextRectangle()

Changes the bounding rectangle for the selected text item to the specified size.

document.setTextSelection()

Sets the text selection of the currently selected text field to the values specified by the startIndex and endIndex values.

document.setTextString()

Inserts a string of text.

document.setTransformationPoint()

Moves the transformation point of the current selection.

document.skewSelection()

Skews the selection by a specified amount.

document.smoothSelection()

Smooths the curve of each selected fill outline or curved line.

document.space()

Spaces the objects in the selection evenly.

document.straightenSelection()

Straightens the currently selected strokes; equivalent to using the Straighten button in the Tools panel.

document.swapElement()

Swaps the current selection with the specified one.

document.swapStrokeAndFill()

Swaps the Stroke and Fill colors.

document.synchronizeWithHeadVersion()

Synchronizes the specified document with the most current version on the Version Cue server and logs any errors to the Output panel.

document.testMovie()

Executes a Test Movie operation on the document.

document.testScene()

Executes a Test Scene operation on the current scene of the document.

document.traceBitmap()

Performs a trace bitmap on the current selection; equivalent to selecting Modify > Bitmap > Trace Bitmap.

document.transformSelection()

Performs a general transformation on the current selection by applying the matrix specified in the arguments.

document.translate3DCenter()

Sets the XYZ position around which the selection is translated or rotated.

document.translate3DSelection()

Applies a 3D translation to the selection.

document.unGroup()

Ungroups the current selection.

document.union()

Combines all selected shapes into a drawing object.

document.unlockAllElements()

Unlocks all locked elements on the currently selected frame.

document.xmlPanel()

Posts a XMLUI dialog box.

Property summary

You can use the following properties with the Document object.

Property

Description

document.accName

A string that is equivalent to the Name field in the Accessibility panel.

document.as3AutoDeclare

A Boolean value that describes whether the instances placed on the Stage are automatically added to user-defined timeline classes.

document.as3Dialect

A string that describes the ActionScript 3.0 “dialect” being used in the specified document.

document.as3ExportFrame

An integer that specifies in which frame to export ActionScript 3.0 classes.

document.as3StrictMode

A Boolean value that specifies whether the ActionScript 3.0 compiler should compile with the Strict Mode option turned on or off.

document.as3WarningsMode

A Boolean value that specifies whether the ActionScript 3.0 compiler should compile with the Warnings Mode option turned on or off.

document.asVersion

An integer that specifies which version of ActionScript is being used in the specified file.

document.autoLabel

A Boolean value that is equivalent to the Auto Label check box in the Accessibility panel.

document.backgroundColor

A string, hexadecimal value, or integer that represents the background color.

document.currentPublishProfile

A string that specifies the name of the active publish profile for the specified document.

document.currentTimeline

An integer that specifies the index of the active timeline.

document.description

A string that is equivalent to the Description field in the Accessibility panel.

document.docClass

Specifies the top-level ActionScript 3.0 class associated with the document.

document.externalLibraryPath

A string that contains a list of items in the document’s ActionScript 3.0 External library path, which specifies the location of SWC files used as runtime shared libraries.

document.forceSimple

A Boolean value that specifies whether the children of the specified object are accessible.

document.frameRate

A float value that specifies the number of frames displayed per second when the SWF file plays; the default is 12.

document.height

An integer that specifies the height of the document (Stage) in pixels.

document.id

A unique integer (assigned automatically) that identifies a document during a Flash session.

document.library

Read-only; the library object for a document.

document.libraryPath

A string that contains a list of items in the document’s ActionScript 3.0 Library path, which specifies the location of SWC files or folders containing SWC files.

document.livePreview

A Boolean value that specifies whether Live Preview is enabled.

document.name

Read-only; a string that represents the name of a document (FLA file).

document.path

Read-only; a string that represents the path of the document, in a platform-specific format.

document.pathURI

Read-only; a string that represents the path of the document, expressed as a file:/// URI.

document.publishProfiles

Read-only; an array of the publish profile names for the document.

document.screenOutline

Read-only; the current ScreenOutline object for the document.

document.selection

An array of the selected objects in the document.

document.silent

A Boolean value that specifies whether the object is accessible.

document.sourcePath

A string that contains a list of items in the document’s ActionScript 3.0 Source path, which specifies the location of ActionScript class files.

document.timelines

Read-only; an array of Timeline objects (see Timeline object).

document.viewMatrix

Read-only; a Matrix object.

document.width

An integer that specifies the width of the document (Stage) in pixels.

document.zoomFactor

Specifies the zoom percent of the Stage at authoring time.