< Day Day Up > |
Availability Flash MX 2004. Description The Document object represents the Stage. That is, only FLA files are considered documents. Method summary for the Document objectYou can use the following methods with the Document object.
Property summary for the Document objectYou can use the following properties with the Document object.
document.accNameAvailability Flash MX 2004. Usage document.accName Description Property; a string that is equivalent to the Name field in the Accessibility panel. Screen readers identify objects by reading the name aloud. Example The following example sets the accessibility name of the document to "Main Movie": fl.getDocumentDOM().accName = "Main Movie"; The following example gets the accessibility name of the document: fl.trace(fl.getDocumentDOM().accName); document.addDataToDocument()Availability Flash MX 2004. Usage document.addDataToDocument( name, type, data ) Parameters name A string that specifies the name of the data to add. type A string that defines the type of data to add. Acceptable values are type are "integer", "integerArray", "double", "doubleArray", "string", and "byteArray". data the value to add. Valid types depend on the type parameter. Returns Nothing. Description Method; stores specified data with a document. Data is written to the FLA file and is available to JavaScript when the file reopens. Example The following example adds an integer value of 12 to the current document: fl.getDocumentDOM().addDataToDocument("myData", "integer", 12); The following example returns the value of the data named "myData" and displays the result in the Output panel: fl.trace(fl.getDocumentDOM().getDataFromDocument("myData")); See also document.getDataFromDocument(), document.removeDataFromDocument() document.addDataToSelection()Availability Flash MX 2004. Usage document.addDataToSelection( name, type, data ) Parameters name A string that specifies the name of the persistent data. type Defines the type of data. Acceptable values are "integer", "integerArray", "double", "doubleArray", "string", and "byteArray". data The value to add. Valid types depend on the type parameter. Returns Nothing. Description Method; stores specified data with the selected object(s). Data is written to the FLA file and is available to JavaScript when the file reopens. Only symbols and bitmaps support persistent data. Example The following example adds an integer value of 12 to the selected object: fl.getDocumentDOM().addDataToSelection("myData", "integer", 12); See also document.removeDataFromSelection() document.addFilter()Availability Flash 8. Usage document.addFilter( filterName ) Parameters filterName A string specifying the filter to be added to the Filter list and enabled for the selected object(s). Acceptable values are "adjustColorFilter", "bevelFilter", "blurFilter", "dropShadowFilter", "glowFilter", "gradientBevelFilter", and "gradientGlowFilter". Returns Nothing. Description Method; applies a filter to the selected objects and places the filter at the end of the Filter list. Example The following example applies a glow filter to the selected object(s): fl.getDocumentDOM().addFilter("glowFilter"); See also document.changeFilterOrder(), document.disableFilter(), document.enableFilter(), document.getFilters(), document.removeFilter(), document.setBlendMode(), document.setFilterProperty() document.addItem()Availability Flash MX 2004. Usage document.addItem( position, item ) Parameters position A point that specifies the x and y coordinates of the location at which to add the item. It uses the center of a symbol or the upper-left corner of a bitmap or video. item An Item object that specifies the item to add and the library from which to add it (see Item object). Returns A Boolean value: true if successful; false otherwise. Description Method; adds an item from any open document or library to the specified Document object. Example The following example adds the first item from the library to the first document at the specified location for the selected symbol, bitmap, or video: var item = fl.documents[0].library.items[0]; fl.documents[0].addItem({x:0,y:0}, item); The following example adds the symbol myMovieClip from the current document's library to the current document: var itemIndex = fl.getDocumentDOM().library.findItemIndex("myMovieClip"); var theItem = fl.getDocumentDOM().library.items[itemIndex]; fl.getDocumentDOM().addItem({x:0,y:0}, theItem); The following example adds the symbol myMovieClip from the second document in the documents array to the third document in the documents array: var itemIndex = fl.documents[1].library.findItemIndex("myMovieClip"); var theItem = fl.documents[1].library.items[itemIndex]; fl.documents[2].addItem({x:0,y:0}, theItem); document.addNewLine()Availability Flash MX 2004. Usage document.addNewLine( startPoint, endpoint ) Parameters startpoint A pair of floating-point numbers that specify the x and y coordinates where the line starts. endpoint A pair of floating-point numbers that specify the x and y coordinates where the line ends. Returns Nothing. Description Method; adds a new path between two points. The method uses the document's current stroke attributes and adds the path on the current frame and current layer. This method works in the same way as clicking on the line tool and drawing a line. Example The following example adds a line between the specified starting point and ending point: fl.getDocumentDOM().addNewLine({x:216.7, y:122.3}, {x:366.8, y:165.8}); document.addNewOval()Availability Flash MX 2004. Usage document.addNewOval( boundingRectangle [, bSuppressFill [, bSuppressStroke ]] ) Parameters boundingRectangle A rectangle that specifies the bounds of the oval to be added. For information on the format of boundingRectangle, see document.addNewRectangle(). bSuppressFill A Boolean value that, if set to TRue, causes the method to create the shape without a fill. The default value is false. This parameter is optional. bSuppressStroke A Boolean value that, if set to TRue, causes the method to create the shape without a stroke. The default value is false. This parameter is optional. Returns Nothing. Description Method; adds a new oval in the specified bounding rectangle. This method performs the same operation as the oval tool. The method uses the document's current default stroke and fill attributes and adds the oval on the current frame and layer. If bSuppressFill is set to TRue, the oval is drawn without a fill. If bSuppressStroke is set to true, the oval is drawn without a stroke. If both bSuppressFill and bSuppressStroke are set to true, the method has no effect. Example The following example adds a new oval within the specified coordinates; it is 164 pixels in width and 178 pixels in height: flash.getDocumentDOM().addNewOval({left:72,top:50,right:236,bottom:228}); The following example draws the oval without a fill: flash.getDocumentDOM().addNewOval({left:72,top:50,right:236,bottom:228}, true); The following example draws the oval without a stroke: flash.getDocumentDOM().addNewOval({left:72,top:50,right:236,bottom:228}, false, true); document.addNewPublishProfile()Availability Flash MX 2004. Usage document.addNewPublishProfile( [profileName ] ) Parameters profileName The unique name of the new profile. If you do not specify a name, a default name is provided. This parameter is optional. Returns An integer that is the index of the new profile in the profiles list. Returns -1 if a new profile cannot be created. Description Method; adds a new publish profile and makes it the current one. Example The following example adds a new publish profile with a default name and then displays the name of the profile in the Output panel: fl.getDocumentDOM().addNewPublishProfile(); fl.outputPanel.trace(fl.getDocumentDOM().currentPublishProfile); The following example adds a new publish profile with the name "my profile": fl.getDocumentDOM().addNewPublishProfile("my profile"); See also document.deletePublishProfile() document.addNewRectangle()Availability Flash MX 2004. Usage document.addNewRectangle( boundingRectangle, roundness [, bSuppressFill [, bSuppressStroke ] ] ) Parameters boundingRectangle A rectangle that specifies the bounds within which the new rectangle is added, in the format {left:value1,top:value2,right:value3,bottom:value4}. The left and top values specify the location of the upper-left corner (e.g., left:0,top:0 represents the upper-left of the Stage), and the right and bottom values specify the location of the lower-right corner. Therefore, the width of the rectangle is the difference in value between left and right, and the height of the rectangle is the difference in value between top and bottom. In other words, the rectangle bounds do not all correspond to the values shown in the Property inspector. The left and top values correspond to the X and Y values in the Property inspector, respectively. However, the right and bottom values don't correspond to the W and H values in the Property inspector. For example, consider a rectangle with the following bounds: {left:10,top:10,right:50,bottom:100} This rectangle would display the following values in the Property inspector: X = 10, Y = 10, W = 40, H = 90 roundness An integer value from 0 to 999 that specifies the roundness to use for the corners. The value is specified as number of points. The greater the value, the greater the roundness. bSuppressFill A Boolean value that, if set to TRue, causes the method to create the shape without a fill. The default value is false. This parameter is optional. bSuppressStroke A Boolean value that, if set to TRue, causes the method to create the rectangle without a stroke. The default value is false. This parameter is optional. Returns Nothing. Description Method; adds a new rectangle or rounded rectangle, fitting it into the specified bounds. This method performs the same operation as the rectangle tool. The method uses the document's current default stroke and fill attributes and adds the rectangle on the current frame and layer. If the bSuppressFill parameter is set to true, the rectangle is drawn without a fill. If the bSuppressStroke parameter is set to TRue, the rectangle is drawn without a stroke. If both bSuppressFill and bSuppressStroke are set to TRue, the method has no effect. Example The following example adds a new rectangle with no rounding on the corners within the specified coordinates; it is 100 pixels in width and in height: flash.getDocumentDOM().addNewRectangle({left:0,top:0,right:100,bottom:100}, 0); The following example adds a new rectangle with no rounding on the corners and without a fill; it is 100 pixels in width and 200 in height: flash.getDocumentDOM().addNewRectangle({left:10,top:10,right:110,bottom:210 },0, true); The following example adds a new rectangle with no rounding on the corners and without a stroke; it is 200 pixels in width and 100 in height: flash.getDocumentDOM().addNewRectangle({left:20,top:20,right:220,bottom:120 },0, false, true); document.addNewScene()Availability Flash MX 2004. Usage document.addNewScene( [name] ) Parameters name Specifies the name of the scene. If you do not specify a name, a new scene name is generated. Returns A Boolean value: true if the scene is added successfully; false otherwise. Description Method; adds a new scene (Timeline object) as the next scene after the currently selected scene and makes the new scene the currently selected scene. If the specified scene name already exists, the scene is not added and the method returns an error. Example The following example adds a new scene named myScene after the current scene in the current document. The variable success will be true when the new scene is created; false otherwise. var success = flash.getDocumentDOM().addNewScene("myScene"); The following example adds a new scene using the default naming convention. If only one scene exists, the newly created scene is named "Scene 2". fl.getDocumentDOM().addNewScene(); document.addNewText()Availability Flash MX 2004. Usage document.addNewText( boundingRectangle ) Parameters boundingRectangle Specifies the size and location of the text field; for information on the format of boundingRectangle, see document.addNewRectangle(). It should be followed by calling document.seTextString() to populate the new text box. Returns Nothing. Description Method; inserts a new empty text field. Example The following example creates a new text field in the upper-left corner of the Stage and then sets the text string to "Hello World": fl.getDocumentDOM().addNewText({left:0, top:0, right:100, bottom:100}); fl.getDocumentDOM().setTextString('Hello World!'); See also document.setTextString() document.align()Availability Flash MX 2004. Usage document.align( alignmode [, bUseDocumentBounds ] ) Parameters alignmode A string that specifies how to align the selection. Acceptable values are "left", "right", "top", "bottom", "vertical center", and "horizontal center". bUseDocumentBounds A Boolean value that, if set to TRue, causes the method to align to the bounds of the document. Otherwise, the method uses the bounds of the selected objects. The default is false. This parameter is optional. Returns Nothing. Description Method; aligns the selection. Example The following example aligns objects to left and to the Stage. This is equivalent to turning on the To Stage setting in the Align panel and clicking the Align to Left button: fl.getDocumentDOM().align("left", true); See also document.distribute(), document.getAlignToDocument(), document.setAlignToDocument() document.allowScreens()Availability Flash MX 2004. Usage document.allowScreens() Parameters None. Returns A Boolean value: true if document.screenOutline can be used safely; false otherwise. Description Method; use before using the document.screenOutline property. If this method returns the value true, you can safely access document.screenOutline; Flash displays an error if you access document.screenOutline in a document without screens. Example The following example determines whether screens methods can be used in the current document: if(fl.getDocumentDOM().allowScreens()) { fl.trace("screen outline is available."); } else { fl.trace("whoops, no screens."); } See also document.screenOutline document.arrange()Availability Flash MX 2004. Usage document.arrange( arrangeMode ) Parameters arrangeMode Specifies the direction in which to move the selection. Acceptable values are "back", "backward", "forward", and "front". It provides the same capabilities as these options provide on the Modify >Arrange menu. Returns Nothing. Description Method; arranges the selection on the Stage. This method applies only to non-shape objects. Example The following example moves the current selection to the front: fl.getDocumentDOM().arrange("front"); document.autoLabelAvailability Flash MX 2004. Usage document.autoLabel Description Property; a Boolean value that is equivalent to the Auto Label check box in the Accessibility panel. You can use this property to tell Flash to automatically label objects on the Stage with the text associated with them. Example The following example gets the value of the autoLabel property and displays the result in the Output panel: var isAutoLabel = fl.getDocumentDOM().autoLabel; fl.trace(isAutoLabel); The following example sets the autoLabel property to true, telling Flash to automatically label objects on the Stage: fl.getDocumentDOM().autoLabel = true; document.backgroundColorAvailability Flash MX 2004. Usage document.backgroundColor Description Property; the color of the background, in one of the following formats:
Example The following example sets the background color to black: fl.getDocumentDOM().backgroundColor = '#000000'; document.breakApart()Availability Flash MX 2004. Usage document.breakApart() Parameters None. Returns Nothing. Description Method; performs a break-apart operation on the current selection. Example The following example breaks apart the current selection: fl.getDocumentDOM().breakApart(); document.canEditSymbol()Availability Flash MX 2004. Usage document.canEditSymbol() Parameters None. Returns A Boolean value: true if the Edit Symbols menu and functionality are available for use; false otherwise. Description Method; indicates whether the Edit Symbols menu and functionality are enabled. This is not related to whether the selection can be edited. This method should not be used to test whether fl.getDocumentDOM().enterEditMode() is allowed. Example The following example displays in the Output panel the state of the Edit Symbols menu and functionality: fl.trace("fl.getDocumentDOM().canEditSymbol() returns: " + fl.getDocumentDOM().canEditSymbol()); document.canRevert()Availability Flash MX 2004. Usage document.canRevert() Parameters None. Returns A Boolean value: true if you can use the document.revert() or fl.revertDocument() methods successfully; false otherwise. Description Method; determines whether you can use the document.revert() or fl.revertDocument() method successfully. Example The following example checks whether the current document can revert to the previously saved version. If so, fl.getDocumentDOM().revert() restores the previously saved version. if(fl.getDocumentDOM().canRevert()){ fl.getDocumentDOM().revert(); } document.canTestMovie()Availability Flash MX 2004. Usage document.canTestMovie() Parameters None. Returns A Boolean value: true if you can use the document.testMovie() method successfully: false otherwise. Description Method; determines whether you can use the document.testMovie() method successfully. Example The following example tests whether fl.getDocumentDOM().testMovie() can be used. If so, it calls the method. if(fl.getDocumentDOM().canTestMovie()){ fl.getDocumentDOM().testMovie(); } See also document.canTestScene(), document.testScene() document.canTestScene()Availability Flash MX 2004. Usage document.canTestScene() Parameters None. Returns A Boolean value: true if you can use the document.testScene() method successfully; false otherwise. Description Method; determines whether you can use the document.testScene() method successfully. Example The following example first tests whether fl.getDocumentDOM().testScene() can be used successfully. If so, it calls the method. if(fl.getDocumentDOM().canTestScene()){ fl.getDocumentDOM().testScene(); } See also document.canTestMovie(), document.testMovie() document.changeFilterOrder()Availability Flash 8. Usage document.changeFilterOrder( oldIndex, newIndex ) Parameters oldIndex An integer that represents the current zero-based index position of the filter you want to reposition in the Filters list. newIndex An integer that represents the new index position of the filter in the list. Returns Nothing. Description Method; changes the index of the filter in the Filter list. Any filters above or below newIndex are shifted up or down accordingly. For example, using the filters shown below, if you issue the command fl.getDocumentDOM().changeFilterOrder(3, 0), the filters are rearranged as follows:
If you then issue the command fl.getDocumentDOM().changeFilterOrder(0, 2), the filters are rearranged as follows:
Example The following example moves the filter that is currently in the second position in the Filter list to the first position: fl.getDocumentDOM().changeFilterOrder(1,0); See also document.addFilter(), document.disableFilter(), document.enableFilter(), document.getFilters(), document.removeFilter(), Filter object document.clipCopy()Availability Flash MX 2004. Usage document.clipCopy() Parameters None. Returns Nothing. Description Method; copies the current selection from the document to the Clipboard. Example The following example copies the current selection from the document to the Clipboard: fl.getDocumentDOM().clipCopy(); document.clipCut()Availability Flash MX 2004. Usage document.clipCut() Parameters None. Returns Nothing. Description Method; cuts the current selection from the document and writes it to the Clipboard. Example The following example cuts the current selection from the document and writes it to the Clipboard: fl.getDocumentDOM().clipCut(); document.clipPaste()Availability Flash MX 2004. Usage document.clipPaste( [bInPlace] ) Parameters bInPlace A Boolean value that, when set to true, causes the method to perform a paste-inplace operation. The default value is false, which causes the method to perform a paste operation to the center of the document. This parameter is optional. Returns Nothing. Description Method; pastes the contents of the Clipboard into the document. Example The following examples pastes the Clipboard contents to the center of the document: fl.getDocumentDOM().clipPaste(); The following example pastes the Clipboard contents in place in the current document: fl.getDocumentDOM().clipPaste(true); document.close()Availability Flash MX 2004. Usage document.close( [bPromptToSaveChanges] ) Parameters bPromptToSaveChanges A Boolean value that, when set to true, causes the method to prompt the user with a dialog box if there are unsaved changes in the document. If bPromptToSaveChanges is set to false, the user is not prompted to save any changed documents. The default value is true. This parameter is optional. Returns Nothing. Description Method; closes the specified document. Example The following example closes the current document and prompts the user with a dialog box to save changes: fl.getDocumentDOM().close(); The following example closes the current document without saving changes: fl.getDocumentDOM().close(false); document.convertLinesToFills()Availability Flash MX 2004. Usage document.convertLinesToFills() Parameters None. Returns Nothing. Description Method; converts lines to fills on the selected objects. Example The following example converts the current selected lines to fills: fl.getDocumentDOM().convertLinesToFills(); document.convertToSymbol()Availability Flash MX 2004. Usage document.convertToSymbol( type, name, registrationPoint ) Parameters type A string that specifies the type of symbol to create. Acceptable values are "movie clip", "button", and "graphic". name A string that specifies the name for the new symbol, which must be unique. You can submit an empty string to have this method create a unique symbol name for you. registration point Specifies the point that represents the 0,0 location for the symbol. Acceptable values are: "top left", "top center", "top right", "center left", "center", "center right", "bottom left", "bottom center", and "bottom right". Returns An object for the newly created symbol, or null if it cannot create the symbol. Description Method; converts the selected Stage item(s) to a new symbol. For information on defining linkage and shared asset properties for a symbol, see Item object. Example The following examples create a movie clip symbol with a specified name, a button symbol with a specified name, and a movie clip symbol with a default name: newMc = fl.getDocumentDOM().convertToSymbol("movie clip", "mcSymbolName", "top left"); newButton = fl.getDocumentDOM().convertToSymbol("button", "btnSymbolName", "bottom right"); newClipWithDefaultName = fl.getDocumentDOM().convertToSymbol("movie clip", "", "top left"); document.crop()Availability Flash 8. Usage document.crop() Parameters None. Returns A Boolean value: true if successful; false otherwise. Description Method; uses the top selected drawing object to crop all selected drawing objects underneath it. This method returns false if there are no drawing objects selected or if any of the selected items are not drawing objects. Example The following example crops the currently selected objects: fl.getDocumentDOM().crop(); See also document.deleteEnvelope(), document.intersect(), document.punch(), document.union(), shape.isDrawingObject document.currentPublishProfileAvailability Flash MX 2004. Usage document.currentPublishProfile Description Property; a string that specifies the name of the active publish profile for the specified document. Example The following example adds a new publish profile with the default name and then displays the name of the profile in the Output panel: fl.getDocumentDOM().addNewPublishProfile(); fl.outputPanel.trace(fl.getDocumentDOM().currentPublishProfile); The following example changes the selected publish profile to "Default": fl.getDocumentDOM().currentPublishProfile = "Default"; document.currentTimelineAvailability Flash MX 2004. Usage document.currentTimeline Description Property; an integer that specifies the index of the active timeline. You can set the active timeline by changing the value of this property; the effect is almost equivalent to calling document.editScene(). The only difference is that you don't get an error message if the index of the timeline is not valid; the property is simply not set, which causes silent failure. Example The following example displays the index of the current timeline. var myCurrentTL = fl.getDocumentDOM().currentTimeline; fl.trace("The index of the current timeline is: "+ myCurrentTL); The following example changes the active timeline from the main timeline to a scene named "myScene". var i = 0; var curTimelines = fl.getDocumentDOM().timelines; while(i < fl.getDocumentDOM().timelines.length){ if(curTimelines[i].name == "myScene"){ fl.getDocumentDOM().currentTimeline = i; } ++i; } See also document.getTimeline() document.deleteEnvelope()Availability Flash 8. Usage document.deleteEnvelope(); Parameters None. Returns A Boolean value: true if successful; false otherwise. Description Method; deletes the envelope (bounding box that contains one or more objects) from the selected objects. Example The following example deletes the envelope from the selected objects: fl.getDocumentDOM().deleteEnvelope(); See also document.crop(), document.intersect(), document.punch(), document.union(), shape.isDrawingObject document.deletePublishProfile()Availability Flash MX 2004. Usage document.deletePublishProfile() Parameters None. Returns An integer that is the index of the new current profile. If a new profile is not available, the method leaves the current profile unchanged and returns its index. Description Method; deletes the currently active profile, if there is more than one. There must be at least one profile left. Example The following example deletes the currently active profile, if there is more than one, and displays the index of the new currently active profile: alert(fl.getDocumentDOM().deletePublishProfile()); See also document.addNewPublishProfile() document.deleteScene()Availability Flash MX 2004. Usage document.deleteScene() Parameters None. Returns A Boolean value: TRue if the scene is successfully deleted; false otherwise. Description Method; 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. If the deleted scene was the last one, it sets the first object as the current Timeline object. If only one Timeline object (scene) exists, it returns the value false. Example Assuming there are three scenes (Scene0, Scene1, and Scene2) in the current document, the following example makes Scene2 the current scene and then deletes it: fl.getDocumentDOM().editScene(2); var success = fl.getDocumentDOM().deleteScene(); document.deleteSelection()Availability Flash MX 2004. Usage document.deleteSelection() Parameters None. Returns Nothing. Description Method; deletes the current selection on the Stage. Displays an error message if there is no selection. Example The following example deletes the current selection in the document: fl.getDocumentDOM().deleteSelection(); document.descriptionAvailability Flash MX 2004. Usage document.description Description Property; a string that is equivalent to the Description field in the Accessibility panel. The description is read by the screen reader. Example The following example sets the description of the document: fl.getDocumentDOM().description= "This is the main movie"; The following example gets the description of the document and displays it in the Output panel: fl.trace(fl.getDocumentDOM().description); document.disableAllFilters()Availability Flash 8. Usage document.disableAllFilters() Parameters None. Returns Nothing. Description Method; disables all filters on the selected objects. Example The following example disables all filters on the selected objects: fl.getDocumentDOM().disableAllFilters(); See also document.addFilter(), document.changeFilterOrder(), document.disableFilter(), document.disableOtherFilters(), document.enableAllFilters(), document.getFilters(), document.removeAllFilters(), Filter object document.disableFilter()Availability Flash 8. Usage document.disableFilter( filterIndex ) Parameters filterIndex An integer representing the zero-based index of the filter in the Filter list. Returns Nothing. Description Method; disables the specified filter in the Filters list. Example The following example disables the first and third filters (index values of 0 and 2) in the Filters list from the selected object(s): fl.getDocumentDOM().disableFilter(0); fl.getDocumentDOM().disableFilter(2); See also document.addFilter(), document.changeFilterOrder(), document.disableAllFilters(), document.disableOtherFilters(), document.enableFilter(), document.getFilters(), document.removeFilter(), Filter object document.disableOtherFilters()Availability Flash 8. Usage document.disableOtherFilters( enabledFilterIndex ) Parameters enabledFilterIndex An integer representing the zero-based index of the filter that should remain enabled after other filters are disabled. Returns Nothing. Description Method; disables all filters except the one at the specified position in the Filters list. Example The following example disables all filters except the second filter in the list (index value of 1): fl.getDocumentDom().disableOtherFilters(1); See also document.addFilter(), document.changeFilterOrder(), document.disableAllFilters(), document.disableFilter(), document.enableFilter(), document.getFilters(), document.removeFilter(), Filter object document.distribute()Availability Flash MX 2004. Usage document.distribute( distributemode [, bUseDocumentBounds ] ) Parameters distributemode A string that specifies where to distribute the selected object. Acceptable values are "left edge", "horizontal center", "right edge", "top edge", "vertical center", and "bottom edge". bUseDocumentBounds A Boolean value that, when set to true, distributes the selected objects using the bounds of the document. Otherwise, the method uses the bounds of the selected object. The default is false. Returns Nothing. Description Method; distributes the selection. Example The following example distributes the selected objects by the top edge: fl.getDocumentDOM().distribute("top edge"); The following example distributes the selected objects by top edge and expressly sets the bUseDcoumentBounds parameter: fl.getDocumentDOM().distribute("top edge", false); The following example distributes the selected objects by their top edges, using the bounds of the document: fl.getDocumentDOM().distribute("top edge", true); See also document.getAlignToDocument(), document.setAlignToDocument() document.distributeToLayers()Availability Flash MX 2004. Usage document.distributeToLayers() Parameters None. Returns Nothing. Description Method; performs a distribute-to-layers operation on the current selection equivalent to selecting Distribute to Layers. This method displays an error if there is no selection. Example The following example distributes the current selection to layers: fl.getDocumentDOM().distributeToLayers(); document.documentHasData()Availability Flash MX 2004. Usage document.documentHasData( name ) Parameters name A string that specifies the name of the data to check. Returns A Boolean value: TRue if the document has persistent data; false otherwise. Description Method; checks the document for persistent data with the specified name. Example The following example checks the document for persistent data with the name "myData": var hasData = fl.getDocumentDOM().documentHasData("myData"); See also document.addDataToDocument(), document.getDataFromDocument(), document.removeDataFromDocument() document.duplicatePublishProfile()Availability Flash MX 2004. Usage document.duplicatePublishProfile( [profileName ] ) Parameters profileName A string that specifies the unique name of the duplicated profile. If you do not specify a name, the method uses the default name. This parameter is optional. Returns An integer that is the index of the new profile in the profile list. Returns -1 if the profile cannot be duplicated. Description Method; duplicates the currently active profile and gives the duplicate version focus. Example The following example duplicates the currently active profile and displays the index of the new profile in the Output panel: fl.trace(fl.getDocumentDOM().duplicatePublishProfile("dup profile")); document.duplicateScene()Availability Flash MX 2004. Usage document.duplicateScene() Parameters None. Returns A Boolean value: TRue if the scene is duplicated successfully; false otherwise. Description Method; makes a copy of the currently selected scene, giving the new scene a unique name and making it the current scene. Example The following example duplicates the second scene in the current document: fl.getDocumentDOM().editScene(1); //set the middle scene to current scene var success = fl.getDocumentDOM().duplicateScene(); document.duplicateSelection()Availability Flash MX 2004. Usage document.duplicateSelection() Parameters None. Returns Nothing. Description Method; duplicates the selection on the Stage. Example The following example duplicates the current selection, which is similar to Alt-clicking and then dragging an item: fl.getDocumentDOM().duplicateSelection(); document.editScene()Availability Flash MX 2004. Usage document.editScene( index ) Parameters index A zero-based integer that specifies which scene to edit. Returns Nothing. Description Method; makes the specified scene the currently selected scene for editing. Example Assuming that there are three scenes (Scene0, Scene1, and Scene2) in the current document, the following example makes Scene2 the current scene and then deletes it: fl.getDocumentDOM().editScene(2); fl.getDocumentDOM().deleteScene(); document.enableAllFilters()Availability Flash 8. Usage document.enableAllFilters() Parameters None. Returns Nothing. Description Method; enables all the filters on the Filters list for the selected object(s). Example The following example enables all the filters on the Filters list for the selected object(s): fl.getDocumentDOM().enableAllFilters() See also document.addFilter(), document.changeFilterOrder(), document.disableAllFilters(), document.enableFilter(), document.getFilters(), document.removeAllFilters(), Filter object document.enableFilter()Availability Flash 8. Usage document.enableFilter( filterIndex ) Parameters filterIndex An integer specifying the zero-based index of the filter in the Filters list to enable. Returns Nothing. Description Method; enables the specified filter for the selected object(s). Example The following example enables the second filter of the selected object(s): fl.getDocumentDOM().enableFilter(1); See also document.addFilter(), document.changeFilterOrder(), document.disableFilter(), document.enableAllFilters(), document.getFilters(), document.removeFilter(), Filter object document.enterEditMode()Availability Flash MX 2004. Usage document.enterEditMode( [editMode] ) Parameters editMode A string that specifies the editing mode. Acceptable values are "inPlace" or "newWindow". If no parameter is specified, the default is symbol-editing mode. This parameter is optional. Returns Nothing. Description Method; switches the authoring tool into the editing mode specified by the parameter. If no parameter is specified, the method defaults to symbol-editing mode, which has the same result as right-clicking the symbol to invoke the context menu and selecting Edit. Example The following example puts Flash in edit-in-place mode for the currently selected symbol: fl.getDocumentDOM().enterEditMode('inPlace'); The following example puts Flash in edit-in-new-window mode for the currently selected symbol: fl.getDocumentDOM().enterEditMode('newWindow'); See also document.exitEditMode() document.exitEditMode()Availability Flash MX 2004. Usage document.exitEditMode() Parameters None. Returns Nothing. Description Method; exits from symbol-editing mode and returns focus to the next level up from the editing mode. For example, if you are editing a symbol inside another symbol, this method takes you up a level from the symbol you are editing, into the parent symbol. Example The following example exits symbol-editing mode: fl.getDocumentDOM().exitEditMode(); See also document.enterEditMode() document.exportPNG()Availability Flash 8. Usage document.exportPNG([fileURI [, bCurrentPNGSettings [, bCurrentFrame]]]) Parameters fileURI A string, expressed as a file:/// URI, that specifies the filename for the exported file. If fileURI is an empty string or is not specified, Flash displays the Export Movie dialog box. bCurrentPNGSettings A Boolean value that specifies whether to use the current PNG publish settings (true) or to display the Export PNG dialog box (false). This parameter is optional. The default value is false. bCurrentFrame A Boolean value that specifies whether to export only the current frame (TRue) or to export all frames, with each frame a separate PNG file (false). This parameter is optional. The default value is false. Returns A Boolean value of true if the file is successfully exported as a PNG file; false otherwise. Description Method; exports the document as one or more PNG files. If fileURI is specified and the file already exists, it is overwritten without warning. Example The following example exports the current frame in the current document to myFile.png, using the current PNG publish settings: fl.getDocumentDOM().exportPNG("file:///C|/myProject/myFile.png", true, true); document.exportPublishProfile()Availability Flash MX 2004. Usage document.exportPublishProfile( fileURI ) Parameters fileURI A string, expressed as a file:/// URI, that specifies the path of the XML file to which the profile is exported. Returns Nothing. Description Method; exports the currently active profile to an XML file. Example The following example exports the currently active profile to the file named profile.xml in the folder /Documents and Settings/username/Desktop on the C drive: fl.getDocumentDOM().exportPublishProfile('file:///C|/Documents and Settings/username/Desktop/profile.xml'); document.exportSWF()Availability Flash MX 2004. Usage document.exportSWF( [ fileURI [, bCurrentSettings ] ] ) Parameters fileURI A string, expressed as a file:/// URI, that specifies the name of the exported file. If fileURI is empty or not specified, Flash displays the Export Movie dialog box. This parameter is optional. bCurrentSettings A Boolean value that, when set to TRue, causes Flash to use current SWF publish settings. Otherwise, Flash displays the Export Flash Player dialog box. The default is false. This parameter is optional. Returns Nothing. Description Method; exports the document in the Flash SWF format. Example The following example exports the document to the specified file location with the current publish settings: fl.getDocumentDOM().exportSWF("file:///C|/Documents and Settings/joe_user/ Desktop/qwerty.swf"); The following example displays the Export Movie dialog box and the Export Flash Player dialog box and then exports the document based on the specified settings: fl.getDocumentDOM().exportSWF("", true); The following example displays the Export Movie dialog box and then exports the document based on the specified settings: fl.getDocumentDOM().exportSWF(); document.forceSimpleAvailability Flash MX 2004. Usage document.forceSimple Description Property; a Boolean value that specifies whether the children of the specified object are accessible. This is equivalent to the inverse logic of the Make Child Objects Accessible setting in the Accessibility panel. That is, if forceSimple is TRue, it is the same as the Make Child Object Accessible option being unchecked. If forceSimple is false, it is the same as the Make Child Object Accessible option being checked. Example The following example sets the areChildrenAccessible variable to the value of the forceSimple property; a value of false means the children are accessible: var areChildrenAccessible = fl.getDocumentDOM().forceSimple; The following example sets the forceSimple property to allow the children of the document to be accessible: fl.getDocumentDOM().forceSimple = false; document.frameRateAvailability Flash MX 2004. Usage document.frameRate Description Property; a float value that specifies the number of frames displayed per second when the SWF file plays; the default is 12. Setting this property is the same as setting the default frame rate in the Document Properties dialog box (Modify > Document) in the FLA file. Example The following example sets the frame rate to 25.5 frames per second: fl.getDocumentDOM().frameRate = 25.5; document.getAlignToDocument()Availability Flash MX 2004. Usage document.getAlignToDocument() Parameters None. Returns A Boolean value: TRue if the preference is set to align the objects to the Stage; false otherwise. Description Method; identical to retrieving the value of the To Stage button in the Align panel. Gets the preference that can be used for document.align(), document.distribute(), document.match(), and document.space() methods on the document. Example The following example retrieves the value of the To Stage button in the Align panel. If the return value is TRue, the To Stage button is active; otherwise, it is not. var isAlignToDoc = fl.getDocumentDOM().getAlignToDocument(); fl.getDocumentDOM().align("left", isAlignToDoc); See also document.setAlignToDocument() document.getBlendMode()Availability Flash 8. Usage document.getBlendMode() Parameters None. Returns A string that specifies the blend mode for the selected object(s). If more than one object is selected and they have different blend modes, the string reflects the blend mode of the object with the highest depth. NOTE The return value is unpredictable if the selection contains objects that don't support blend modes, or that have a blend mode value of "normal". Description Method; returns a string that specifies the blend mode for the selected object(s). Example The following example displays the name of the blend mode in the Output panel: fl.trace(fl.getDocumentDom().getBlendMode()); document.getCustomFill()Availability Flash MX 2004. Usage document.getCustomFill( [ objectToFill ] ) Parameters objectToFill A string that specifies the location of the fill object. The following values are valid:
If you omit this parameter, the default value is "selection". If there is no selection, the method returns undefined. This parameter is optional. Returns The Fill object specified by the objectToFill parameter, if successful; otherwise, it returns undefined. Description Method; retrieves the fill object of the selected shape or, if specified, of the Tools panel and Property inspector. Example The following example gets the fill object of the selection and then changes the selection's color to white: var fill = fl.getDocumentDOM().getCustomFill(); fill.color = '#FFFFFF'; fill.style = "solid"; fl.getDocumentDOM().setCustomFill(fill); The following example returns the fill object of the Tools panel and Property inspector and then changes the color swatch to a linear gradient: var fill = fl.getDocumentDOM().getCustomFill("toolbar"); fill.style = "linearGradient"; fill.colorArray = [ 0x00ff00, 0xff0000, 0x0000ff ]; fill.posArray = [0, 100, 200]; fl.getDocumentDOM().setCustomFill( fill ); See also document.setCustomFill() document.getCustomStroke()Availability Flash MX 2004. Usage document.getCustomStroke( [locationOfStroke] ) Parameters locationOfStroke A string that specifies the location of the stroke object. The following values are valid:
If you omit this parameter, it defaults to "selection". If there is no selection, it returns undefined. This parameter is optional. Returns The Stroke object specified by the locationOfStroke parameter, if successful; otherwise, it returns undefined. Description Returns the stroke object of the selected shape or, if specified, of the Tools panel and Property inspector. Example The following example returns the current stroke settings of the selection and changes the stroke thickness to 2: var stroke = fl.getDocumentDOM().getCustomStroke("selection"); stroke.thickness = 2; fl.getDocumentDOM().setCustomStroke(stroke); The following example returns the current stroke settings of the Tools panel and Property inspector and sets the stroke color to red: var stroke = fl.getDocumentDOM().getCustomStroke("toolbar"); stroke.color = "#FF0000"; fl.getDocumentDOM().setCustomStroke(stroke); See also document.setCustomStroke() document.getDataFromDocument()Availability Flash MX 2004. Usage document.getDataFromDocument( name ) Parameters name A string that specifies the name of the data to return. Returns The specified data. Description Method; retrieves the value of the specified data. The type returned depends on the type of data that was stored. Example The following example adds an integer value of 12 to the current document and uses this method to display the value in the Output panel: fl.getDocumentDOM().addDataToDocument("myData", "integer", 12); fl.trace(fl.getDocumentDOM().getDataFromDocument("myData")); See also document.addDataToDocument(), document.documentHasData(), document.removeDataFromDocument() document.getElementProperty()Availability Flash MX 2004. Usage document.getElementProperty( propertyName ) Parameters propertyName A string that specifies the name of the Element property for which to retrieve the value. Returns The value of the specified property. Returns null if the property is an indeterminate state, as when multiple elements are selected with different property values. Returns undefined if the property is not a valid property of the selected element. Description Method; gets the specified Element property for the current selection. For a list of acceptable values, see "Property summary for the Element object" on page 193. Example The following example gets the name of the Element property for the current selection: // elementName = the instance name of the selected object. var elementName = fl.getDocumentDOM().getElementProperty("name"); See also document.setElementProperty() document.getElementTextAttr()Availability Flash MX 2004. Usage document.getElementTextAttr( attrName [, startIndex [, endIndex]] ) Parameters attrName A string that specifies the name of the TextAttrs property to be returned. For a list of property names and expected values, see "Property summary for the TextAttrs object" on page 457. startIndex An integer that specifies the index of first character, with 0 (zero) specifying the first position. This parameter is optional. endIndex An integer that specifies the index of last character. This parameter is optional. Returns If one text field is selected, the property is returned if there is only one value used within the text. Returns undefined if there are several values used inside the text field. If several text fields are selected, and all the text alignment values are equal, the method returns this value. If several text fields are selected, but all the text alignment values are not equal, the method returns undefined. If the optional arguments are not passed, these rules apply to the range of text currently selected or the whole text field if the text is not currently being edited. If only startIndex is passed, the property of the character to the right of the index is returned, if all the selected text objects match values. If startIndex and endIndex are passed, the value returned reflects the entire range of characters from startIndex up to, but not including, endIndex. Description Method; gets a specific TextAttrs property of the selected text objects. Selected objects that are not text fields are ignored. For a list of property names and expected values, see "Property summary for the TextAttrs object" on page 457. See also document.setElementTextAttr(). Example The following example gets the size of the selected text fields: fl.getDocumentDOM().getElementTextAttr("size"); The following example gets the color of the character at index 3 in the selected text fields: fl.getDocumentDOM().getElementTextAttr("fillColor", 3); The following example gets the font name of the text from index 2 up to, but not including, index 10 of the selected text fields: fl.getDocumentDOM().getElementTextAttr("face", 2, 10); document.getFilters()Availability Flash 8. Usage document.getFilters() Parameters None. Returns An array that contains a list of filters applied to the currently selected object(s). Description Method; returns an array that contains the list of filters applied to the currently selected object(s). If multiple objects are selected and they don't have identical filters, this method returns the list of filters applied to the first selected object. Example See document.setFilters(). See also document.addFilter(), document.changeFilterOrder(), document.setFilters(), Filter object document.getMetadata()Availability Flash 8. Usage document.getMetadata() Parameters None. Returns A string containing the XML metadata associated with the document, or an empty string if there is no metadata. Description Method; returns a string containing the XML metadata associated with the document, or an empty string if there is no metadata. Example The following example displays XML metadata from the current document in the Output panel: fl.trace("XML Metadata is :" + fl.getDocumentDOM().getMetadata()); See also document.setMetadata() document.getSelectionRect()Availability Flash MX 2004. Usage document.getSelectionRect() Parameters None. Returns The bounding rectangle of the current selection, or 0 if nothing is selected. For information on the format of the return value, see document.addNewRectangle(). Description Method; gets the bounding rectangle of the current selection. If a selection is non-rectangular, the smallest rectangle encompassing the entire selection is returned. The rectangle is based on the document space or, when in edit mode, the registration point of the symbol being edited. Example The following example gets the bounding rectangle for the current selection and then displays its properties: var newRect = fl.getDocumentDOM().getSelectionRect(); var outputStr = "left: " + newRect.left + " top: " + newRect.top + " right: " + newRect.right + " bottom: " + newRect.bottom; alert(outputStr); See also document.selection, document.setSelectionRect() document.getTextString()Availability Flash MX 2004. Usage document.getTextString( [startIndex [, endIndex]] ) Parameters startIndex An integer that is an index of first character to get. This parameter is optional. endIndex An integer that is an index of last character to get. This parameter is optional. Returns A string that contains the selected text. Description Method; gets the currently selected text. If the optional parameters are not passed, the current text selection is used. If text is not currently opened for editing, the whole text string is returned. If only startIndex is passed, the string starting at that index and ending at the end of the field is returned. If startIndex and endIndex are passed, the string starting from startIndex up to, but not including, endIndex is returned. If there are several text fields selected, the concatenation of all the strings is returned. Example The following example gets the string in the selected text fields: fl.getDocumentDOM().getTextString(); The following example gets the string at character index 5 in the selected text fields: fl.getDocumentDOM().getTextString(5); The following example gets the string from character index 2 up to, but not including, character index 10: fl.getDocumentDOM().getTextString(2, 10); See also document.setTextString() document.getTimeline()Availability Flash MX 2004. Usage document.getTimeline() Parameters None. Returns The current Timeline object. Description Method; retrieves the current Timeline object in the document. The current timeline can be the current scene, the current symbol being edited, or the current screen. Example The following example gets the Timeline object and returns the number of frames in the longest layer: var longestLayer = fl.getDocumentDOM().getTimeline().frameCount; fl.trace("The longest layer has" + longestLayer + "frames"); The following example enters edit-in-place mode for the selected symbol on the Stage and inserts a frame on the symbol's timeline. fl.getDocumentDOM().enterEditMode("inPlace"); fl.getDocumentDOM().getTimeline().insertFrames(); The following example gets the Timeline object and displays its name: var timeline = fl.getDocumentDOM().getTimeline(); alert(timeline.name); See also document.currentTimeline, document.timelines, symbolItem.timeline document.getTransformationPoint()Availability Flash MX 2004. Usage document.getTransformationPoint() Parameters None. Returns The location of the transformation point. Description Method; gets the location of the transformation point of the current selection. You can use the transformation point for commutations such as rotate and skew. Example The following example gets the transformation point for the current selection. The transPoint.x property gives the x coordinate of the transformation point. The TRansPoint.y property gives the y coordinate of the transformation point: var transPoint = fl.getDocumentDOM().getTransformationPoint(); See also document.setTransformationPoint() document.group()Availability Flash MX 2004. Usage document.group() Parameters None. Returns Nothing. Description Method; converts the current selection to a group. Example The following example converts the objects in the current selection to a group: fl.getDocumentDOM().group(); See also document.unGroup() document.heightAvailability Flash MX 2004. Usage document.height Description Property; an integer that specifies the height of the document (Stage) in pixels. Example The following example sets the height of the Stage to 400 pixels: fl.getDocumentDOM().height = 400; See also document.width document.importFile()Availability Flash 8. Usage document.importFile(fileURI [, importToLibrary]) Parameters fileURI A string, expressed as a file:/// URI, that specifies the path of the file to import. importToLibrary A Boolean value that specifies whether to import the file only into the document's library (true) or to also place a copy on the Stage (false). The default value is false. Returns A Boolean value that indicates whether the file was successfully imported. Description Method; imports a file into a document. This method performs the same operation as the Import to Library or Import to Stage menu command. To import a publish profile, use document.importPublishProfile(). Example The following example lets the user browse for a file to import onto the Stage. var dom = fl.getDocumentDOM(); var URI = fl.browseForFileURL("select", "Import File"); dom.importFile(URI); See also document.importSWF(), fl.browseForFileURL() document.importPublishProfile()Availability Flash MX 2004. Usage document.importPublishProfile( fileURI ) Parameters fileURI A string, expressed as a file:/// URI, that specifies the path of the XML file defining the profile to import. Returns An integer that is the index of the imported profile in the profiles list. Returns -1 if the profile cannot be imported. Description Method; imports a profile from a file. Example The following example imports the profile contained in the profile.xml file and displays its index in the profiles list: alert(fl.getDocumentDOM().importPublishProfile('file:///C|/Documents and Settings/janeUser/Desktop/profile.xml')); document.importSWF()Availability Flash MX 2004. Usage document.importSWF( fileURI ) Parameters fileURI A string, expressed as a file:/// URI, that specifies the file for the SWF file to import. Returns Nothing. Description Method; imports a SWF file into the document. This method performs the same operation as using the Import menu command to specify a SWF file. In Flash 8 and later, you can also use document.importFile() to import a SWF file (as well as other types of files). Example The following example imports the "mySwf.swf" file from the Flash Configuration folder: fl.getDocumentDOM().importSWF(fl.configURI+"mySwf.swf"); See also document.importFile() document.intersect()Availability Flash 8. Usage document.intersect(); Parameters None. Returns A Boolean value: TRue if successful; false otherwise. Description Method; creates an intersection drawing object from all selected drawing objects. This method returns false if there are no drawing objects selected, or if any of the selected items are not drawing objects. Example The following example creates an intersection drawing object from all selected drawing objects. fl.getDocumentDOM().intersect(); See also document.crop(), document.deleteEnvelope(), document.punch(), document.union(), shape.isDrawingObject document.libraryAvailability Flash MX 2004. Usage document.library Description Read-only property; the library object for a document. Example The following example gets the library for the currently focused document: var myCurrentLib = fl.getDocumentDOM().library; Assuming the currently focused document is not fl.documents[1], the following example gets the library for a non-focused library or for a library you opened using File > Open as external library: var externalLib = fl.documents[1].library; document.livePreviewAvailability Flash MX 2004. Usage document.livePreview Description Property; a Boolean value that specifies if Live Preview is enabled. If set to true, components appear on the Stage as they will appear in the published Flash content, including their approximate size. If set to false, components appear only as outlines. The default value is true. Example The following example sets Live Preview to false: fl.getDocumentDOM().livePreview = false; document.match()Availability Flash MX 2004. Usage document.match( bWidth, bHeight [, bUseDocumentBounds] ) Parameters bWidth A Boolean value that, when set to true, causes the method to make the widths of the selected items the same. bHeight A Boolean value that, when set to TRue, causes the method to make the heights of the selected items the same. bUseDocumentBounds A Boolean value that, when set to TRue, causes the method to match the size of the objects to the bounds of the document. Otherwise, the method uses the bounds of the largest object. The default is false. This parameter is optional. Returns Nothing. Description Method; makes the size of the selected objects the same. Example The following example matches the width of the selected objects only: fl.getDocumentDOM().match(true,false); The following example matches the height only: fl.getDocumentDOM().match(false,true); The following example matches the width only to the bounds of the document: fl.getDocumentDOM().match(true,false,true); See also document.getAlignToDocument(), document.setAlignToDocument() document.mouseClick()Availability Flash MX 2004. Usage document.mouseClick( position, bToggleSel, bShiftSel ) Parameters position A pair of floating-point values that specify the x and y coordinates of the click in pixels. bToggleSel A Boolean value that specifies the state of the Shift key: TRue for pressed; false for not pressed. bShiftSel A Boolean value that specifies the state of the application preference Shift select: TRue for on; false for off. Returns Nothing. Description Method; performs a mouse click from the arrow tool. Example The following example performs a mouse click at the specified location: fl.getDocumentDOM().mouseClick({x:300, y:200}, false); See also document.mouseDblClk() document.mouseDblClk()Availability Flash MX 2004. Usage document.mouseDblClk( position, bAltDown, bShiftDown, bShiftSelect ) Parameters position A pair of floating-point values that specify the x and y coordinates of the click in pixels. bAltdown A Boolean value that records whether the Alt key is down at the time of the event: true for pressed; false for not pressed. bShiftDown A Boolean value that records whether the Shift key was down when the event occurred: TRue for pressed; false for not pressed. bShiftSelect A Boolean value that indicates the state of the application preference Shift select: TRue for on; false for off. Returns Nothing. Description Method; performs a double mouse click from the arrow tool. Example The following example performs a double mouse click at the specified location: fl.getDocumentDOM().mouseDblClk({x:392.9, y:73}, false, false, true); See also document.mouseClick() document.moveSelectedBezierPointsBy()Availability Flash MX 2004. Usage document.moveSelectedBezierPointsBy( delta ) Parameters delta A pair of floating-point values that specify the x and y coordinates in pixels by which the selected Bézier points are moved. For example, passing ({x:1,y:2}) specifies a location that is to the right by one pixel and down by two pixels from the current location. Returns Nothing. Description Method; if the selection contains at least one path with at least one Bézier point selected, moves all selected Bézier points on all selected paths by the specified amount. Example The following example moves the selected Bézier points 10 pixels to the right and 5 pixels down: fl.getDocumentDOM().moveSelectedBezierPointsBy({x:10, y:5}); document.moveSelectionBy()Availability Flash MX 2004. Usage document.moveSelectionBy( distanceToMove ) Parameters distanceToMove A pair of floating-point values that specify the x and y coordinate values by which the method moves the selection. For example, passing ({x:1,y:2}) specifies a location one pixel to the right and two pixels down from the current location. Returns Nothing. Description Method; moves selected objects by a specified distance. Note When using arrow keys to move the item, the History panel combines all presses of the arrow key as one move step. When the user presses the arrow keys repeatedly, rather than taking multiple steps in the History panel, the method performs one step, and the arguments are updated to reflect the repeated arrow keys. For information on making a selection, see document.setSelectionRect(), document.mouseClick(), document.mouseDblClk(), and the Element object. Example The following example moves the selected item 62 pixels to the right and 84 pixels down: flash.getDocumentDOM().moveSelectionBy({x:62, y:84}); document.nameAvailability Flash MX 2004. Usage document.name Description Read-only property; a string that represents the name of a document (FLA file). Example The following example sets the variable fileName to the filename of the first document in the documents array: var fileName = flash.documents[0].name; The following example displays the names of all the open documents in the Output panel: var openDocs = fl.documents; for(var i=0;i < opendocs.length; i++){ fl.trace(i + " " + opendocs[i].name +"\n"); } document.optimizeCurves()Availability Flash MX 2004. Usage document.optimizeCurves( smoothing, bUseMultiplePasses ) Parameters smoothing An integer in the range from 0 to 100, with 0 specifying no smoothing, and 100 specifying maximum smoothing. bUseMultiplePasses A Boolean value that, when set to TRue, indicates that the method should use multiple passes, which is slower but produces a better result. This parameter has the same effect as clicking the Use multiple passes button in the Optimize Curves dialog box. Returns Nothing. Description Method; optimizes smoothing for the current selection, allowing multiple passes, if specified, for optimal smoothing. This method is equivalent to selecting Modify > Shape > Optimize. Example The following example optimizes the curve of the current selection to 50° of smoothing with multiple passes: fl.getDocumentDOM().optimizeCurves(50, true); document.pathAvailability Flash MX 2004. Usage document.path Description Read-only property; a string that represents the path of the document in a platform-specific format. If the document has never been saved, this property is undefined. Example The following example displays the path of the first document in the documents array in the Output panel: var filePath = flash.documents[0].path; fl.trace(filePath); document.publish()Availability Flash MX 2004. Usage document.publish() Parameters None. Returns Nothing. Description Method; publishes the document according to the active Publish Settings (File > Publish Settings). This method is equivalent to selecting File > Publish. Example The following example publishes the current document: fl.getDocumentDOM().publish(); document.publishProfilesAvailability Flash MX 2004. Usage document.publishProfiles Description Read-only property; an array of the publish profile names for the document. Example The following example displays the names of the publish profiles for the document: var myPubProfiles = fl.getDocumentDOM().publishProfiles; for (var i=0; i < myPubProfiles.length; i++){ fl.trace(myPubProfiles[i]); } document.punch()Availability Flash 8. Usage document.punch() Parameters None. Returns A Boolean value: TRue if successful; false otherwise. Description Method; uses top selected drawing object to punch through all selected drawing objects underneath it. This method returns false if there are no drawing objects selected, or if any of the selected items are not drawing objects. Example The following example punches through drawing objects underneath the selected drawing object: fl.getDocumentDOM().punch(); See also document.crop(), document.deleteEnvelope(), document.intersect(), document.union(), shape.isDrawingObject document.removeDataFromDocument()Availability Flash MX 2004. Usage document.removeDataFromDocument( name ) Parameters name A string that specifies the name of the data to remove. Returns Nothing. Description Method; removes persistent data with the specified name that has been attached to the document. Example The following example removes from the document the persistent data named "myData": fl.getDocumentDOM().removeDataFromDocument("myData"); See also document.addDataToDocument(), document.documentHasData(), document.getDataFromDocument() document.removeDataFromSelection()Availability Flash MX 2004. Usage document.removeDataFromSelection( name ) Parameters name A string that specifies the name of the persistent data to remove. Returns Nothing. Description Method; removes persistent data with the specified name that has been attached to the selection. Example The following example removes from the selection the persistent data named "myData": fl.getDocumentDOM().removeDataFromSelection("myData"); See also document.addDataToSelection() document.removeAllFilters()Availability Flash 8. Usage document.removeAllFilters() Parameters None. Returns Nothing. Description Method; removes all filters from the selected object(s). Example The following example removes all filters from the selected object(s): fl.getDocumentDOM().removeAllFilters(); See also document.addFilter(), document.changeFilterOrder(), document.disableAllFilters(), document.getFilters(), document.removeFilter(), Filter object document.removeFilter()Availability Flash 8. Usage document.removeFilter( filterIndex ) Parameters filterIndex An integer specifying the zero-based index of the filter to remove from the selected object(s). Returns Nothing. Description Method; removes the specified filter from the Filters list of the selected object(s). Example The following example removes the first filter (index value 0) from the Filters list of the selected object(s): fl.getDocumentDOM().removeFilter(0); See also document.addFilter(), document.changeFilterOrder(), document.disableFilter(), document.getFilters(), document.removeAllFilters(), Filter object document.renamePublishProfile()Availability Flash MX 2004. Usage document.renamePublishProfile( [profileNewName ] ) Parameters profileNewName An optional parameter that specifies the new name for the profile. The new name must be unique. If the name is not specified, a default name is provided. Returns A Boolean value: true if the name is changed successfully; false otherwise. Description Method; renames the current profile. Example The following example renames the current profile to a default name and displays it: alert(fl.getDocumentDOM().renamePublishProfile()); document.renameScene()Availability Flash MX 2004. Usage document.renameScene( name ) Parameters name A string that specifies the new name of the scene. Returns A Boolean value: true if the name is changed successfully; false otherwise. If the new name is not unique, for example, the method returns false. Description Method; renames the currently selected scene in the Scenes panel. The new name for the selected scene must be unique. Example The following example renames the current scene to "new name": var success = fl.getDocumentDOM().renameScene("new name"); document.reorderScene()Availability Flash MX 2004. Usage document.reorderScene( sceneToMove, sceneToPutItBefore ) Parameters sceneToMove An integer that specifies which scene to move, with 0 (zero) being the first scene. sceneToPutItBefore An integer that specifies the scene before which you want to move the scene specified by sceneToMove. Specify 0 (zero) for the first scene. For example, if you specify 1 for sceneToMove and 0 for sceneToPutItBefore, the second scene is placed before the first scene. Specify -1 to move the scene to the end. Returns Nothing. Description Method; moves the specified scene before another specified scene. Example The following example moves the second scene to before the first scene: fl.getDocumentDOM().reorderScene(1, 0); document.resetTransformation()Availability Flash MX 2004. Usage document.resetTransformation() Parameters None. Returns Nothing. Description Method; resets the transformation matrix. This method is equivalent to selecting Modify > Transform > Remove transform. Example The following example resets the transformation matrix for the current selection: fl.getDocumentDOM().resetTransformation(); document.revert()Availability Flash MX 2004. Usage document.revert() Parameters None. Returns Nothing. Description Method; reverts the specified document to its previously saved version. This method is equivalent to selecting File > Revert. Example The following example reverts the current document to the previously saved version: fl.getDocumentDOM().revert(); See also document.canRevert(), fl.revertDocument() document.rotateSelection()Availability Flash MX 2004. Usage document.rotateSelection( angle [, rotationPoint] ) Parameters angle A floating-point value that specifies the angle of the rotation. rotationPoint A string that specifies which side of the bounding box to rotate. Acceptable values are "top right", "top left", "bottom right", "bottom left", "top center", "right center", "bottom center", and "left center". If unspecified, the method uses the transformation point. This parameter is optional. Returns Nothing. Description Method; rotates the selection by a specified number of degrees. The effect is the same as using the Free Transform tool to rotate the object. Example The following example rotates the selection by 45° around the transformation point: flash.getDocumentDOM().rotateSelection(45); The following example rotates the selection by 45° around the lower-left corner: fl.getDocumentDOM().rotateSelection(45, "bottom left"); document.save()Availability Flash MX 2004. Usage document.save( [ bOkToSaveAs ] ) Parameters bOkToSaveAs An optional parameter that specifies whether to open the Save As dialog box. Returns A Boolean value: true if the save operation completes successfully; false otherwise. Description Method; saves the document in its default location. This method is equivalent to selecting File > Save. Note If the file has never been saved, or has not been modified since the last time it was saved, the file isn't saved and false is returned. To allow an unsaved or unmodified file to be saved, use fl.saveDocumentAs(). Example The following example saves the current document in its default location: fl.getDocumentDOM().save(); See also document.saveAndCompact(), fl.saveAll(), fl.saveDocument(), fl.saveDocumentAs() document.saveAndCompact()Availability Flash MX 2004. Usage document.saveAndCompact( [ bOkToSaveAs ] ) Parameters bOkToSaveAs An optional parameter that, if true or omitted and the file was never saved, opens the Save As dialog box. If false and the file was never saved, the file is not saved. The default value is true. Returns A Boolean value: TRue if the save-and-compact operation completes successfully; false otherwise. Description Method; saves and compacts the file. This method is equivalent to selecting File > Save and Compact. Note If the file has never been saved, this method returns true even if the user cancels the Save As dialog box. To allow an unsaved file to be saved, use fl.saveDocumentAs(). Example The following example saves and compacts the current document: fl.getDocumentDOM().saveAndCompact(); See also document.save(), fl.saveDocumentAs(), fl.saveDocument(), fl.saveAll() document.scaleSelection()Availability Flash MX 2004. Usage document.scaleSelection( xScale, yScale [, whichCorner] ) Parameters xScale A floating-point value that specifies the amount of x by which to scale. yScale A floating-point value that specifies the amount of y by which to scale. whichCorner A string value that specifies the edge about which the transformation occurs. If omitted, scaling occurs about the transformation point. Acceptable values are: "bottom left", "bottom right", "top right", "top left", "top center", "right center", "bottom center", and "left center". This parameter is optional. Returns Nothing. Description Method; scales the selection by a specified amount. This method is equivalent to using the Free Transform tool to scale the object. Example The following example expands the width of the current selection to double the original width and shrinks the height to half: flash.getDocumentDOM().scaleSelection(2.0, 0.5); The following example flips the selection vertically: fl.getDocumentDOM().scaleSelection(1, -1); The following example flips the selection horizontally: fl.getDocumentDOM().scaleSelection(-1, 1); The following example scales the selection vertically by 1.9 from the top center: fl.getDocumentDOM().scaleSelection(1, 1.90, 'top center'); document.screenOutlineAvailability Flash MX 2004. Usage document.screenOutline Description Read-only property; the current ScreenOutline object for the document. Before accessing the object for the first time, make sure to use document.allowScreens() to determine whether the property exists. Example The following example displays the array of values in the screenOutline property: var myArray = new Array(); for(var i in fl.getDocumentDOM().screenOutline) { myArray.push(" "+i+" : "+fl.getDocumentDOM().screenOutline[i]) ; } fl.trace("Here is the property dump for screenOutline: "+myArray); See also document.allowScreens(), ScreenOutline object document.selectAll()Availability Flash MX 2004. Usage document.selectAll() Parameters None. Returns Nothing. Description Method; selects all items on the Stage. This method is equivalent to pressing Control+A (Windows) or Command+A (Macintosh) or selecting Edit > Select All. Example The following example selects everything that is currently visible to the user: fl.getDocumentDOM().selectAll(); See also document.selection, document.selectNone() document.selectionAvailability Flash MX 2004. Usage document.selection Description Property; an array of the selected objects in the document. If nothing is selected, returns an array of length zero. If no document is open, returns null. To add objects to the array, you must first select them in one of the following ways:
Example The following example assigns all elements on Frame 11 to the current selection (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().currentFrame = 10; fl.getDocumentDOM().selection = fl.getDocumentDOM().getTimeline().layers[0].frames[10].elements; The following example creates a rectangle in the upper-left corner of the Stage and a text string underneath the rectangle. Then it selects both objects using document.setSelectionRect() and adds them to the document.selection array. Finally, it displays the contents of document.selection in the Output panel. fl.getDocumentDOM().addNewRectangle({left:0, top:0, right:99, bottom:99}, 0); fl.getDocumentDOM().addNewText({left:-1, top:117.3, right:9.2, bottom:134.6}); fl.getDocumentDOM().setTextString('Hello World'); fl.getDocumentDOM().setSelectionRect({left:-28, top:-22, right:156.0, bottom:163}); var theSelectionArray = fl.getDocumentDOM().selection; for(var i=0;i<theSelectionArray.length;i++){ fl.trace("fl.getDocumentDOM().selection["+i+"] = " + theSelectionArray[i]); } The following example is an advanced example. It shows how to loop through the layer array and elements array to locate instances of a particular symbol and select them. You could extend this example to include loops for multiple frames or scenes. This example assigns all instances of the movie clip myMovieClip in the first frame to the current selection: // Assigns the layers array to the variable "theLayers". var theLayers = fl.getDocumentDOM().getTimeline().layers; // Creates an array to hold all the elements // that are instances of "myMovieClip". var myArray = new Array(); // Counter variable var x = 0; // Begin loop through all the layers. for (var i = 0; i < theLayers.length; i++) { // Gets the array of elements in Frame 1 // and assigns it to the array "theElems". var theElems = theLayers[i].frames[0].elements; // Begin loop through the elements on a layer. for (var c = 0; c < theElems.length; c++) { // Checks to see if the element is of type "instance". if (theElems[c].elementType == "instance") { // If the element is an instance, it checks // if it is an instance of "myMovieClip". if (theElems[c].libraryItem.name == "myMovieClip") { // Assigns elements that are instances of "myMovieClip" to "myArray". myArray[x] = theElems[c]; // Increments counter variable. x++; } } } } // Now that you have assigned all the instances of "myMovieClip" // to "myArray", you then set the document.selection array // equal to myArray. This selects the objects on the Stage. fl.getDocumentDOM().selection = myArray; document.selectNone()Availability Flash MX 2004. Usage document.selectNone() Parameters None. Returns Nothing. Description Method; deselects any selected items. Example The following example deselects any items that are selected: fl.getDocumentDOM().selectNone(); See also document.selectAll(), document.selection document.setAlignToDocument()Availability Flash MX 2004. Usage document.setAlignToDocument( bToStage ) Parameters bToStage A Boolean value that, if set to true, aligns objects to the Stage. If set to false, it does not. Returns Nothing. Description Method; sets the preferences for document.align(), document.distribute(), document.match(), and document.space() to act on the document. This method is equivalent to enabling the To Stage button in the Align panel. Example The following example enables the To Stage button in the Align panel to align objects with the Stage: fl.getDocumentDOM().setAlignToDocument(true); See also document.getAlignToDocument() document.setBlendMode()Availability Flash 8. Usage document.setBlendMode( mode ) Parameters mode A string that represents the desired blend mode for the selected objects. Acceptable values are "normal", "layer", "multiply", "screen", "overlay", "hardlight", "lighten", "darken", "difference", "add", "subtract", "invert", "alpha", and "erase". Returns Nothing. Description Method; sets the blend mode for the selected objects. Example The following example sets the blend mode for the selected object to "add". fl.getDocumentDOM().setBlendMode("add"); See also document.addFilter(), document.setFilterProperty(), symbolInstance.blendMode document.setCustomFill()Availability Flash MX 2004. Usage document.setCustomFill( fill ) Parameters fill A Fill object that specifies the fill settings to be used. See Fill object. Returns Nothing. Description Method; sets the fill settings for the Tools panel, Property inspector, and any selected shapes. This allows a script to set the fill settings before drawing the object, rather than drawing the object, selecting it, and changing the fill settings. It also lets a script change the Tools panel and Property inspector fill settings. Example The following example changes the color of the fill color swatch in the Tools panel, Property inspector, and any selected shapes to white: var fill = fl.getDocumentDOM().getCustomFill(); fill.color = '#FFFFFF'; fill.style = "solid"; fl.getDocumentDOM().setCustomFill(fill); See also document.getCustomFill() document.setCustomStroke()Availability Flash MX 2004. Usage document.setCustomStroke( stroke ) Parameters stroke A Stroke object. Returns Nothing. Description Method; sets the stroke settings for the Tools panel, Property inspector, and any selected shapes. This allows a script to set the stroke settings before drawing the object, rather than drawing the object, selecting it, and changing the stroke settings. It also lets a script change the Tools panel and Property inspector stroke settings. Example The following example changes the stroke thickness setting in the Tools panel, Property inspector, and any selected shapes: var stroke = fl.getDocumentDOM().getCustomStroke(); stroke.thickness += 2; fl.getDocumentDOM().setCustomStroke(stroke); See also document.getCustomStroke() document.setElementProperty()Availability Flash MX 2004. Usage document.setElementProperty( property, value ) Parameters property A string that specifies the name of the Element property to set. For a complete list of properties and values, see "Property summary for the Element object" on page 193. Note You can't use this method to set values for read-only properties, such as element.elementType, element.top, and element.left. value An integer that specifies the value to set in the specified Element property. Returns Nothing. Description Method; sets the specified Element property on selected object(s) in the document. This method does nothing if there is no selection. Example The following example sets the width of all selected objects to 100 and the height to 50: fl.getDocumentDOM().setElementProperty("width", 100); fl.getDocumentDOM().setElementProperty("height", 50); document.setElementTextAttr()Availability Flash MX 2004. Usage document.setElementTextAttr( attrName, attrValue [, startIndex [, endIndex]] ) Parameters attrName A string that specifies the name of the TextAttrs property to change. attrValue The value to which to set the TextAttrs property. For a list of property names and expected values, see "Property summary for the TextAttrs object" on page 457. startIndex An integer value that specifies the index of the first character that is affected. This parameter is optional. endIndex An integer value that specifies the index of the last character that is affected. This parameter is optional. Returns A Boolean value: true if at least one text attribute property is changed; false otherwise. Description Method; sets the specified textAttrs property of the selected text items to the specified value. For a list of property names and allowable values, see "Property summary for the TextAttrs object" on page 457. If the optional parameters are not passed, the method sets the style of the currently selected text range, or the whole text field if no text is selected. If only startIndex is passed, the method sets that character's attributes. If startIndex and endIndex are passed, the method sets the attributes on the characters starting from startIndex up to, but not including, endIndex. If paragraph styles are specified, all the paragraphs that fall within the range are affected. Example The following examples set the fillColor, italic, and bold text attributes for the selected text items: var success = fl.getDocumentDOM().setElementTextAttr("fillColor", "#00ff00"); var pass = fl.getDocumentDOM().setElementTextAttr("italic", true, 10); var ok = fl.getDocumentDOM().setElementTextAttr("bold", true, 5, 15); document.setFillColor()Availability Flash MX 2004. Usage document.setFillColor( color ) Parameters color The color of the fill, in one of the following formats:
If set to null, no fill color is set, which is the same as setting the Fill color swatch in the user interface to no fill. Returns Nothing. Description Method; changes the fill color of the selection to the specified color. For information on changing the fill color in the Tools panel and Property inspector, see document.setCustomFill(). Example The first three statements in the following example set the fill color using each of the different formats for specifying color. The fourth statement sets the fill to no fill. flash.getDocumentDOM().setFillColor("#cc00cc"); flash.getDocumentDOM().setFillColor(0xcc00cc); flash.getDocumentDOM().setFillColor(120000); flash.getDocumentDOM().setFillColor(null); document.setFilterProperty()Availability Flash 8. Usage document.setFilterProperty( property, filterIndex, value ) Parameters property A string specifying the property to be set. Acceptable values are "blurX", "blurY", "quality", angle", "distance", "strength", "knockout", "inner", "bevelType", "color", "shadowColor", and "highlightColor". filterIndex An integer specifying the zero-based index of the filter in the Filters list. value A number or string specifying the value to be set for the specified filter property. Acceptable values depend on the property and the filter being set. Returns Nothing. Description Method; sets a specified filter property for the currently selected object(s) that support the filter property. Example The following example sets the quality property to 2 for the second filter (index value of 1) in the Filters list of the selected objects, and then sets the shadowColor property of the first filter in the Filters list on the selected object(s): fl.getDocumentDOM().setFilterProperty("quality", 1, 2); fl.getDocumentDOM().setFilterProperty("shadowColor", 0, "#FF00FF"); See also document.addFilter(), document.getFilters(), document.setBlendMode(), document.setFilters(), Filter object document.setFilters()Availability Flash 8. Usage document.setFilters( filterArray ) Parameters filterArray The array of filters currently specified. Returns Nothing. Description Method; applies filters to the selected objects. Use this method after calling document.getFilters() and making any desired changes to the filters. Example The following example gets the filters on the selected object and sets the blurX property for all Blur filters to 50: var myFilters = fl.getDocumentDOM().getFilters(); for (i=0; i < myFilters.length; i++) { if (myFilters[i].name == "blurFilter"){ myFilters[i].blurX = 50; } } fl.getDocumentDOM().setFilters(myFilters); See also document.addFilter(), document.getFilters(), document.setFilterProperty(), Filter object document.setInstanceAlpha()Availability Flash MX 2004. Usage document.setInstanceAlpha( opacity ) Parameters opacity An integer between 0 (transparent) and 100 (completely saturated) that adjusts the transparency of the instance. Returns Nothing. Description Methods; sets the opacity of the instance. Example The following example sets the opacity of the tint to a value of 50: fl.getDocumentDOM().setInstanceAlpha(50); document.setInstanceBrightness()Availability Flash MX 2004. Usage document.setInstanceBrightness( brightness ) Parameters brightness An integer that specifies brightness as a value from -100 (black) to 100 (white). Returns Nothing. Description Method; sets the brightness for the instance. Example The following example sets the brightness for the instance to a value of 50: fl.getDocumentDOM().setInstanceBrightness(50); document.setInstanceTint()Availability Flash MX 2004. Usage document.setInstanceTint( color, strength ) Parameters color The color of the tint, in one of the following formats:
This parameter is equivalent to picking the Color: Tint value for a symbol in the Property Inspector. strength An integer between 0 and 100 that specifies the opacity of the tint. Returns Nothing. Description Method; sets the tint for the instance. Example The following example sets the tint for the selected instance to red with an opacity value of 50: fl.getDocumentDOM().setInstanceTint(0xff0000, 50); document.setMetadata()Availability Flash 8. Usage document.setMetadata( strMetadata ) Parameters strMetadata A string containing the XML metadata to be associated with the document. For more information, see the following description. Returns A Boolean value: TRue if successful; false otherwise. Description Method; sets the XML metadata for the specified document, overwriting any existing metadata. The XML passed as strMetadata is validated and may be rewritten before being stored. If it cannot be validated as legal XML or violates specific rules, then the XML metadata is not set and false is returned. (If false is returned, there is no way to get more detailed error information.) NOTE Even if true is returned, the XML that is set may not be exactly the same string that you passed in. To get the exact value to which the XML was set, use document.getMetadata(). The format of the metadata is RDF that is compliant with the XMP specification. For more information about RDF and XMP, see the following sources:
Example The following examples show several different legal ways to represent the same data. In all of these cases but the second one, if the data were sent to Document.setMetadata(), it would not be rewritten (aside from removing line breaks). In the first example, metadata is in tags, with different schemas placed in separate rdf:Description tags: <rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <rdf:Description rdf:about='' xmlns:dc='http://purl.org/dc/1.1/'> <dc:title>Simple title</dc:title> <dc:description>Simple description</dc:description> </rdf:Description> <rdf:Description rdf:about='' xmlns:xmp='http://ns.adobe.com/xap/1.0/'> <xmp:CreateDate>2004-10-12T10:29-07:00</xmp:CreateDate> <xmp:CreatorTool>Flash Authoring WIN 8,0,0,215</xmp:CreatorTool> </rdf:Description> </rdf:RDF> In the second example, metadata is in tags, but with different schemas all in one rdf:Description tag. This example also includes comments, which will be ignored and discarded by the Document.setMetadata(): <rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!-- This is before the first rdf:Description tag --> <rdf:Description rdf:about='' xmlns:dc='http://purl.org/dc/1.1/'> <dc:title>Simple title</dc:title> <dc:description>Simple description</dc:description> </rdf:Description> <!-- This is between the two rdf:Description tags --> <rdf:Description rdf:about='' xmlns:xmp='http://ns.adobe.com/xap/1.0/'> <xmp:CreateDate>2004-10-12T10:29-07:00</xmp:CreateDate> <xmp:CreatorTool>Flash Authoring WIN 8,0,0,215</xmp:CreatorTool> </rdf:Description> <!-- This is after the second rdf:Description tag --> </rdf:RDF> In the third example, metadata is in attributes, and different schemas are all in one rdf:Description tag: <rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <rdf:Description rdf:about='' xmlns:dc='http://purl.org/dc/1.1/' dc:title='Simple title' dc:description='Simple description' /> <rdf:Description rdf:about='' xmlns:xmp='http://ns.adobe.com/xap/1.0/' xmp:CreateDate='2004-10-12T10:29-07:00' xmp:CreatorTool='Flash Authoring WIN 8,0,0,215' /> </rdf:RDF> See also document.getMetadata() document.setSelectionBounds()Availability Flash MX 2004; bContactSensitiveSelection parameter added in Flash 8. Usage document.setSelectionBounds(boundingRectangle [, bContactSensitiveSelection]) Parameters boundingRectangle A rectangle that specifies the new location and size of the selection. For information on the format of boundingRectangle, see document.addNewRectangle(). bContactSensitiveSelection A Boolean value that specifies whether the Contact Sensitive selection mode is enabled (TRue) or disabled (false) during object selection. The default value is false. Returns Nothing. Description Method; moves and resizes the selection in a single operation. If you pass a value for bContactSensitiveSelection, it is valid only for this method, and doesn't affect the Contact Sensitive selection mode for the document (see fl.contactSensitiveSelection). Example The following example moves the current selection to 10, 20 and resizes it to 100, 200: var l = 10; var t = 20; fl.getDocumentDOM().setSelectionBounds({left:l, top:t, right:(100+l), bottom:(200+t)}); See also document.selection, document.setSelectionRect() document.setSelectionRect()Availability Flash MX 2004; bContactSensitiveSelection parameter added in Flash 8. Usage document.setSelectionRect(rect [, bReplaceCurrentSelection [, bContactSensitiveSelection]]) Parameters rect A rectangle object to set as selected. For information on the format of rect, see document.addNewRectangle(). bReplaceCurrentSelection A Boolean value that specifies whether the method replaces the current selection (TRue) or adds to the current selection (false). The default value is true. bContactSensitiveSelection A Boolean value that specifies whether the Contact Sensitive selection mode is enabled (true) or disabled (false) during object selection. The default value is false. Returns Nothing. Description Method; draws a rectangular selection marquee relative to the Stage, using the specified coordinates. This is unlike document.getSelectionRect(), in which the rectangle is relative to the object being edited. This method is equivalent to dragging a rectangle with the arrow tool. An instance must be fully enclosed by the rectangle to be selected. If you pass a value for bContactSensitiveSelection, it is valid only for this method, and doesn't affect the Contact Sensitive selection mode for the document (see fl.contactSensitiveSelection). NOTE Repeating setSelectionRect() using the History panel or menu item repeats the step previous to the setSelectionRect() operation. Example In the following example, the second selection replaces the first one: fl.getDocumentDOM().setSelectionRect({left:1, top:1, right:200, bottom:200}); fl.getDocumentDOM().setSelectionRect({left:364.0, top:203.0, right:508.0, bottom:434.0}, true); In the following example, the second selection is added to the first selection. This is the same as the manual operation of holding down Shift and selecting a second object. fl.getDocumentDOM().setSelectionRect({left:1, top:1, right:200, bottom:200}); fl.getDocumentDOM().setSelectionRect({left:364.0, top:203.0, right:508.0, bottom:434.0}, false); See also document.getSelectionRect(), document.selection, document.setSelectionBounds() document.setStroke()Availability Flash MX 2004. Usage document.setStroke( color, size, strokeType ) Parameters color The color of the stroke, in one of the following formats:
size A floating-point value that specifies the new stroke size for the selection. strokeType A string that specifies the new type of stroke for the selection. Acceptable values are "hairline", "solid", "dashed", "dotted", "ragged", "stipple", and "hatched". Returns Nothing. Description Method; sets the color, width, and style of the selected strokes. For information on changing the stroke in the Tools panel and Property inspector, see document.setCustomStroke(). Example The following example sets the color of the stroke to red, the size to 3.25, and the type to dashed: fl.getDocumentDOM().setStroke("#ff0000", 3.25, "dashed"); document.setStrokeColor()Availability Flash MX 2004. Usage document.setStrokeColor( color ) Parameters color The color of the stroke, in one of the following formats:
Returns Nothing. Description Method; changes the stroke color of the selection to the specified color. For information on changing the stroke in the Tools panel and Property inspector, see document.setCustomStroke(). Example The three statements in the following example set the stroke color using each of the different formats for specifying color: flash.getDocumentDOM().setStrokeColor("#cc00cc"); flash.getDocumentDOM().setStrokeColor(0xcc00cc); flash.getDocumentDOM().setStrokeColor(120000); document.setStrokeSize()Availability Flash MX 2004. Usage document.setStrokeSize( size ) Parameters size A floating-point value from 0.25 to 10 that specifies the stroke size. The method ignores precision greater than two decimal places. Returns Nothing. Description Method; changes the stroke size of the selection to the specified size. For information on changing the stroke in the Tools panel and Property inspector, see document.setCustomStroke(). Example The following example changes the stroke size for the selection to 5: fl.getDocumentDOM().setStrokeSize(5); document.setStrokeStyle()Availability Flash MX 2004. Usage document.setStrokeStyle( strokeType ) Parameters strokeType A string that specifies the stroke style for the current selection. Acceptable values are "hairline", "solid", "dashed", "dotted", "ragged", "stipple", and "hatched". Returns Nothing. Description Method; changes the stroke style of the selection to the specified style. For information on changing the stroke in the Tools panel and Property inspector, see document.setCustomStroke(). Example The following example changes the stroke style for the selection to "dashed": fl.getDocumentDOM().setStrokeStyle("dashed"); document.setTextRectangle()Availability Flash MX 2004. Usage document.setTextRectangle( boundingRectangle ) Parameters boundingRectangle A text rectangle object that specifies the new size within which the text item should flow. For information on the format of boundingRectangle, see document.addNewRectangle(). Returns A Boolean value: true if the size of at least one text field is changed; false otherwise. Description Method; changes the bounding rectangle for the selected text item to the specified size. This method causes the text to reflow inside the new rectangle; the text item is not scaled or transformed. The values passed in boundingRectangle are used as follows:
Example The following example changes the size of the bounding text rectangle to the specified dimensions: fl.getDocumentDOM().setTextRectangle({left:0, top:0, right:50, bottom:200}) document.setTextSelection()Availability Flash MX 2004. Usage document.setTextSelection( startIndex, endIndex ) Parameters startIndex An integer that specifies the position of the first character to select. The first character position is 0 (zero). endIndex An integer that specifies the end position of the selection up to, but not including, endIndex. The first character position is 0 (zero). Returns A Boolean value: true if the method can successfully set the text selection; false otherwise. Description Method; sets the text selection of the currently selected text field to the values specified by the startIndex and endIndex values. Text editing is activated, if it isn't already. Example The following example selects the text from the 6th character through the 25th character: fl.document.setTextSelection(5, 25); document.setTextString()Availability Flash MX 2004. Usage document.setTextString( text [, startIndex [, endIndex]] ) Parameters text A string of the characters to insert in the text field. startIndex An integer that specifies first character to replace. The first character position is 0 (zero). This parameter is optional. endIndex An integer that specifies the last character to replace. The first character position is 0 (zero). This parameter is optional. Returns A Boolean value: true if the text of at least one text string is set; false otherwise. Description Method; inserts a string of text. If the optional parameters are not passed, the existing text selection is replaced; if the text object isn't currently being edited, the whole text string is replaced. If only startIndex is passed, the string passed is inserted at this position. If startIndex and endIndex are passed, the string passed replaces the segment of text starting from startIndex up to, but not including, endIndex. Example The following example replaces the current text selection with "Hello World": var success = fl.getDocumentDOM().setTextString("Hello World!"); The following example inserts "hello" at position 6 of the current text selection: var pass = fl.getDocumentDOM().setTextString("hello", 6); The following example inserts "Howdy" starting at position 2 and up to, but not including, position 7 of the current text selection: var ok = fl.getDocumentDOM().setTextString("Howdy", 2, 7); See also document.getTextString() document.setTransformationPoint()Availability Flash MX 2004. Usage document.setTransformationPoint( transformationPoint ) Parameters TRansformationPoint A pair of floating-point numbers that specifies values for each of the following elements:
Returns Nothing. Description Method; moves the transformation point of the current selection. Example The following example sets the transformation point of the current selection to 100, 200: fl.getDocumentDOM().setTransformationPoint({x:100, y:200}); See also document.getTransformationPoint() document.silentAvailability Flash MX 2004. Usage document.silent Description Property; a Boolean value that specifies whether the object is accessible. This is equivalent to the inverse logic of the Make Movie Accessible setting in the Accessibility panel. That is, if document.silent is TRue, it is the same as the Make Movie Accessible option being unchecked. If it is false, it is the same as the Make Movie Accessible option being checked. Example The following example sets the isSilent variable to the value of the silent property: var isSilent = fl.getDocumentDOM().silent; The following example sets the silent property to false, indicating that the document is accessible: fl.getDocumentDOM().silent = false; document.skewSelection()Availability Flash MX 2004. Usage document.skewSelection( xSkew, ySkew [, whichEdge] ) Parameters xSkew A floating-point number that specifies the amount of x by which to skew, measured in degrees. ySkew A floating-point number that specifies the amount of y by which to skew, measured in degrees. whichEdge A string that specifies the edge where the transformation occurs; if omitted, skew occurs at the transformation point. Acceptable values are "top center", "right center", "bottom center", and "left center". This parameter is optional. Returns Nothing. Description Method; skews the selection by a specified amount. The effect is the same as using the Free Transform tool to skew the object. Example The following examples skew the selected object by 2.0 vertically and 1.5 horizontally. The second example transforms the object at the top center edge: flash.getDocumentDOM().skewSelection(2.0, 1.5); flash.getDocumentDOM().skewSelection(2.0, 1.5, "top center"); document.smoothSelection()Availability Flash MX 2004. Usage document.smoothSelection() Parameters None. Returns Nothing. Description Method; smooths the curve of each selected fill outline or curved line. This method performs the same action as the Smooth button in the Tools panel. Example The following example smooths the curve of the current selection: fl.getDocumentDOM().smoothSelection(); document.space()Availability Flash MX 2004. Usage document.space( direction [, bUseDocumentBounds] ) Parameters direction A string that specifies the direction in which to space the objects in the selection. Acceptable values are "horizontal" or "vertical". bUseDocumentBounds A Boolean value that, when set to TRue, spaces the objects to the document bounds. Otherwise, the method uses the bounds of the selected objects. The default is false. This parameter is optional. Returns Nothing. Description Method; spaces the objects in the selection evenly. Example The following example spaces the objects horizontally, relative to the Stage: fl.getDocumentDOM().space("horizontal",true); The following example spaces the objects horizontally, relative to each other: fl.getDocumentDOM().space("horizontal"); The following example spaces the objects horizontally, relative to each other, with bUseDcoumentBounds expressly set to false: fl.getDocumentDOM().space("horizontal",false); See also document.getAlignToDocument(), document.setAlignToDocument() document.straightenSelection()Availability Flash MX 2004. Usage document.straightenSelection() Parameters None. Returns Nothing. Description Method; straightens the currently selected strokes. This method is equivalent to using the Straighten button in the Tools panel. Example The following example straightens the curve of the current selection: fl.getDocumentDOM().straightenSelection(); document.swapElement()Availability Flash MX 2004. Usage document.swapElement( name ) Parameters name A string that specifies the name of the library item to use. Returns Nothing. Description Method; swaps the current selection with the specified one. The selection must contain a graphic, button, movie clip, video, or bitmap. This method displays an error message if no object is selected or the given object could not be found. Example The following example swaps the current selection with Symbol 1 from the library: fl.getDocumentDOM().swapElement('Symbol 1'); document.swapStrokeAndFill()Availability Flash 8. Usage document.swapStrokeAndFill(); Parameters None. Returns Nothing. Description Method; swaps the Stroke and Fill colors. Example The following example swaps the Stroke and Fill colors in the current document: fl.getDocumentDOM().swapStrokeAndFill(); document.testMovie()Availability Flash MX 2004. Usage document.testMovie() Parameters None. Returns Nothing. Description Method; executes a Test Movie operation on the document. Example The following example tests the movie for the current document: fl.getDocumentDOM().testMovie(); See also document.canTestMovie(), document.testScene() document.testScene()Availability Flash MX 2004. Usage document.testScene() Parameters None. Returns Nothing. Description Method; executes a Test Scene operation on the current scene of the document. Example The following example tests the current scene in the document: fl.getDocumentDOM().testScene(); See also document.canTestScene(), document.testMovie() document.timelinesAvailability Flash MX 2004. Usage document.timelines Description Read-only property; an array of Timeline objects (see Timeline object). Example The following example gets the array of current timelines in the active document and displays their names in the Output panel: var i = 0; var curTimelines = fl.getDocumentDOM().timelines; while(i < fl.getDocumentDOM().timelines.length){ alert(curTimelines[i].name); ++i; } See also document.currentTimeline, document.getTimeline() document.traceBitmap()Availability Flash MX 2004. Usage document.traceBitmap( threshold, minimumArea, curveFit, cornerThreshold ) Parameters threshold An integer that controls the number of colors in your traced bitmap. Acceptable values are integers between 0 and 500. minimumArea An integer that specifies the radius measured in pixels. Acceptable values are integers between 1 and 1000. curveFit A string that specifies how smoothly outlines are drawn. Acceptable values are "pixels", "very tight", "tight", "normal", "smooth", and "very smooth". cornerThreshold A string that is similar to curveFit, but it pertains to the corners of the bitmap image. Acceptable values are "many corners", "normal", and "few corners". Returns Nothing. Description Method; performs a trace bitmap on the current selection. This method is equivalent to selecting Modify > Bitmap > Trace Bitmap. Example The following example traces the selected bitmap, using the specified parameters: fl.getDocumentDOM().traceBitmap(0, 500, 'normal', 'normal'); document.transformSelection()Availability Flash MX 2004. Usage document.transformSelection( a, b, c, d) Parameters a A floating-point number that specifies the (0,0) element of the transformation matrix. b A floating-point number that specifies the (0,1) element of the transformation matrix. c A floating-point number that specifies the (1,0) element of the transformation matrix. d A floating-point number that specifies the (1,1) element of the transformation matrix. Returns Nothing. Description Method; performs a general transformation on the current selection by applying the matrix specified in the arguments. For more information, see the element.matrix property. Example The following example stretches the selection by a factor of 2 in the x direction: fl.getDocumentDOM().transformSelection(2.0, 0.0, 0.0, 1.0); document.unGroup()Availability Flash MX 2004. Usage document.unGroup() Parameters None. Returns Nothing. Description Method; ungroups the current selection. Example The following example ungroups the elements in the current selection: fl.getDocumentDOM().unGroup(); See also document.group() document.union()Availability Flash 8. Usage document.union() Parameters None. Returns A Boolean value: TRue if successful; false otherwise. Description Method; combines all selected shapes into a drawing object. Example The following example combines all selected shapes into a drawing object: fl.getDocumentDOM().union(); See also document.crop(), document.deleteEnvelope(), document.intersect(), document.punch(), shape.isDrawingObject document.unlockAllElements()Availability Flash MX 2004. Usage document.unlockAllElements() Parameters None. Returns Nothing. Description Method; unlocks all locked elements on the currently selected frame. Example The following example unlocks all locked objects in the current frame: fl.getDocumentDOM().unlockAllElements(); See also element.locked document.viewMatrixAvailability Flash MX 2004. Usage document.viewMatrix Description Read-only property; a Matrix object. The viewMatrix is used to transform from object space to document space when the document is in edit mode. The mouse location, as a tool receives it, is relative to the object that is currently being edited. See Matrix object. For example, if you create a symbol, double-click to edit it, and draw with the PolyStar tool, the point (0,0) will be at the registration point of the symbol. However, the drawingLayer object expects values in document space, so if you draw a line from (0,0) using the drawingLayer, it will start at the upper-left corner of the Stage. The viewMatrix provides a way to transform from the space of the object being edited to document space. Example The following example gets the value of the viewMatrix property: var mat = fl.getDocumentDOM().viewMatrix; document.widthAvailability Flash MX 2004. Usage document.width Description Property; an integer that specifies the width of the document (Stage) in pixels. Example The following example sets the width of the Stage to 400 pixels. fl.getDocumentDOM().width= 400; See also document.height document.xmlPanel()Availability Flash MX 2004. Usage document.xmlPanel( fileURI ) Parameters fileURI A string, expressed as a file:/// URI, that specifies the path to the XML file defining the controls in the panel. The full path is required. Returns An object that has properties defined for all controls defined in the XML file. All properties are returned as strings. The returned object will have one predefined property named "dismiss" that will have the string value "accept" or "cancel". Description Method; posts an XMLUI dialog box. See fl.xmlui. Example The following example loads the Test.xml file and displays each property contained within it: var obj = fl.getDocumentDOM().xmlPanel(fl.configURI + "Commands/Test.xml"); for (var prop in obj) { fl.trace("property " + prop + " = " + obj[prop]); } document.zoomFactorAvailability Flash 8. Usage document.zoomFactor Description Property; specifies the zoom percent of the Stage at author time. A value of 1 equals 100% zoom, 8 equals 800%, .5 equals 50%, and so on. Example The following example sets the zoom factor of the Stage to 200%. fl.getDocumentDOM().zoomFactor = 2; |
< Day Day Up > |