< Day Day Up > |
Availability Flash MX 2004. Description The Timeline object represents the Flash timeline, which can be accessed for the current document by using fl.getDocumentDOM().getTimeline(). This method returns the timeline of the current scene or symbol that is being edited. When you work with scenes, each scene's timeline has an index value, and can be accessed for the current document by fl.getDocumentDOM().timelines[i]. (In this example, i is the index of the value of the timeline.) When you work with frames by using the methods and properties of the Timeline object, remember that the frame value is a zero-based index (not the actual frame number in the sequence of frames in the timeline). That is, the first frame has a frame index of 0. Method summary for the Timeline objectThe following methods are available for the Timeline object.
Property summary for the Timeline objectThe following methods are available for the Timeline object.
timeline.addMotionGuide()Availability Flash MX 2004. Usage timeline.addMotionGuide() Parameters None. Returns An integer that represents the zero-based index of the newly added guide layer. If the current layer type is not of type "Normal", Flash returns -1. Description Method; adds a motion guide layer above the current layer and attaches the current layer to the newly added guide layer, converting the current layer to a layer of type "Guided". This method functions only on a layer of type "Normal". It has no effect on a layer whose type is "Folder", "Mask", "Masked", "Guide", or "Guided". Example The following example adds a motion guide layer above the current layer, and converts the current layer to "Guided": fl.getDocumentDOM().getTimeline().addMotionGuide(); timeline.addNewLayer()Availability Flash MX 2004. Usage timeline.addNewLayer([name] [, layerType [, bAddAbove]]) Parameters name A string that specifies the name for the new layer. If you omit this parameter, a new default layer name is assigned to the new layer ("Layer n," where n is the total number of layers). This parameter is optional. layerType A string that specifies the type of layer to add. If you omit this parameter, a "Normal" type layer is created. This parameter is optional. bAddAbove A Boolean value that, if set to true (the default), causes Flash to add the new layer above the current layer; false causes Flash to add the layer below the current layer. This parameter is optional. Returns An integer value of the zero-based index of the newly added layer. Description Method; adds a new layer to the document and makes it the current layer. Example The following example adds a new layer to the timeline with a default name generated by Flash: fl.getDocumentDOM().getTimeline().addNewLayer(); The following example adds a new folder layer on top of the current layer and names it "Folder1": fl.getDocumentDOM().getTimeline().addNewLayer("Folder1", "folder", true); timeline.clearFrames()Availability Flash MX 2004. Usage timeline.clearFrames([startFrameIndex [, endFrameIndex]]) Parameters startFrameIndex A zero-based index that defines the beginning of the range of frames to clear. If you omit startFrameIndex, the method uses the current selection. This parameter is optional. endFrameIndex A zero-based index that defines the end of the range of frames to clear. The range goes up to, but does not include, endFrameIndex. If you specify only startFrameIndex, endFrameIndex defaults to the value of startFrameIndex. This parameter is optional. Returns Nothing. Description Method; deletes all the contents from a frame or range of frames on the current layer. Example The following example clears the frames from Frame 6 up to, but not including, Frame 11 (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().clearFrames(5, 10); The following example clears Frame 15: fl.getDocumentDOM().getTimeline().clearFrames(14); timeline.clearKeyframes()Availability Flash MX 2004. Usage timeline.clearKeyframes([startFrameIndex [, endFrameIndex]]) Parameters startFrameIndex A zero-based index that defines the beginning of the range of frames to clear. If you omit startFrameIndex, the method uses the current selection. This parameter is optional. endFrameIndex A zero-based index that defines the end of the range of frames to clear. The range goes up to, but does not include, endFrameIndex. If you specify only startFrameIndex, endFrameIndex defaults to the value of startFrameIndex. This parameter is optional. Returns Nothing. Description Method; converts a keyframe to a regular frame and deletes its contents on the current layer. Example The following example clears the keyframes from Frame 5 up to, but not including, Frame 10 (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().clearKeyframes(4, 9); The following example clears the keyframe at Frame 15 and converts it to a regular frame: fl.getDocumentDOM().getTimeline().clearKeyframes(14); timeline.convertToBlankKeyframes()Availability Flash MX 2004. Usage timeline.convertToBlankKeyframes([startFrameIndex [, endFrameIndex]]) Parameters startFrameIndex A zero-based index that specifies the starting frame to convert to keyframes. If you omit startFrameIndex, the method converts the currently selected frames. This parameter is optional. endFrameIndex A zero-based index that specifies the frame at which the conversion to keyframes will stop. The range of frames to convert goes up to, but does not include, endFrameIndex. If you specify only startFrameIndex, endFrameIndex defaults to the value of startFrameIndex. This parameter is optional. Returns Nothing. Description Method; converts frames to blank keyframes on the current layer. Example The following example converts Frame 2 up to, but not including, Frame 10 to blank keyframes (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().convertToBlankKeyframes(1, 9); The following example converts Frame 5 to a blank keyframe: fl.getDocumentDOM().getTimeline().convertToBlankKeyframes(4); timeline.convertToKeyframes()Availability Flash MX 2004. Usage timeline.convertToKeyframes([startFrameIndex [, endFrameIndex]]) Parameters startFrameIndex A zero-based index that specifies the first frame to convert to keyframes. If you omit startFrameIndex, the method converts the currently selected frames. This parameter is optional. endFrameIndex A zero-based index that specifies the frame at which conversion to keyframes will stop. The range of frames to convert goes up to, but does not include, endFrameIndex. If you specify only startFrameIndex, endFrameIndex defaults to the value of startFrameIndex. This parameter is optional. Returns Nothing. Description Method; converts a range of frames to keyframes (or converts the selection if no frames are specified) on the current layer. Example The following example converts the selected frames to keyframes: fl.getDocumentDOM().getTimeline().convertToKeyframes(); The following example converts to keyframes the frames from Frame 2 up to, but not including, Frame 10 (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().convertToKeyframes(1, 9); The following example converts Frame 5 to a keyframe: fl.getDocumentDOM().getTimeline().convertToKeyframes(4); timeline.copyFrames()Availability Flash MX 2004. Usage timeline.copyFrames([startFrameIndex [, endFrameIndex]]) Parameters startFrameIndex A zero-based index that specifies the beginning of the range of frames to copy. If you omit startFrameIndex, the method uses the current selection. This parameter is optional. endFrameIndex A zero-based index that specifies the frame at which to stop copying. The range of frames to copy goes up to, but does not include, endFrameIndex. If you specify only startFrameIndex, endFrameIndex defaults to the value of startFrameIndex. This parameter is optional. Returns Nothing. Description Method; copies a range of frames on the current layer to the Clipboard. Example The following example copies the selected frames to the Clipboard: fl.getDocumentDOM().getTimeline().copyFrames(); The following example copies Frame 2 up to, but not including, Frame 10, to the Clipboard (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().copyFrames(1, 9); The following example copies Frame 5 to the Clipboard: fl.getDocumentDOM().getTimeline().copyFrames(4); timeline.createMotionTween()Availability Flash MX 2004. Usage timeline.createMotionTween([startFrameIndex [, endFrameIndex]]) Parameters startFrameIndex A zero-based index that specifies the beginning frame at which to create a motion tween. If you omit startFrameIndex, the method uses the current selection. This parameter is optional. endFrameIndex A zero-based index that specifies the frame at which to stop the motion tween. The range of frames goes up to, but does not include, endFrameIndex. If you specify only startFrameIndex, endFrameIndex defaults to the startFrameIndex value. This parameter is optional. Returns Nothing. Description Method; sets the frame.tweenType property to motion for each selected keyframe on the current layer, and converts each frame's contents to a single symbol instance if necessary. This property is the equivalent to the Create Motion Tween menu item in the Flash authoring tool. Example The following example converts the shape in the first frame up to, but not including, Frame 10 to a graphic symbol instance and sets the frame.tweenType to motion (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().createMotionTween(0, 9); timeline.currentFrameAvailability Flash MX 2004. Usage timeline.currentFrame Description Property; the zero-based index for the frame at the current playhead location. Example The following example sets the playhead of the current timeline to Frame 10 (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().currentFrame = 9; The following example stores the value of the current playhead location in the curFrame variable: var curFrame = fl.getDocumentDOM().getTimeline().currentFrame; timeline.currentLayerAvailability Flash MX 2004. Usage timeline.currentLayer Description Property; the zero-based index for the currently active layer. A value of 0 specifies the top layer, a value of 1 specifies the layer below it, and so on. Example The following example makes the top layer active: fl.getDocumentDOM().getTimeline().currentLayer = 0; The following example stores the index of the currently active layer in the curLayer variable: var curLayer = fl.getDocumentDOM().getTimeline().currentLayer; timeline.cutFrames()Availability Flash MX 2004. Usage timeline.cutFrames([startFrameIndex [, endFrameIndex]]) Parameters startFrameIndex A zero-based index that specifies the beginning of a range of frames to cut. If you omit startFrameIndex, the method uses the current selection. This parameter is optional. endFrameIndex A zero-based index that specifies the frame at which to stop cutting. The range of frames goes up to, but does not include, endFrameIndex. If you specify only startFrameIndex, endFrameIndex defaults to the startFrameIndex value. This parameter is optional. Returns Nothing. Description Method; cuts a range of frames on the current layer from the timeline and saves them to the Clipboard. Example The following example cuts the selected frames from the timeline and saves them to the Clipboard: fl.getDocumentDOM().getTimeline().cutFrames(); The following example cuts Frame 2 up to, but not including, Frame 10 from the timeline and saves them to the Clipboard (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().cutFrames(1, 9); The following example cuts Frame 5 from the timeline and saves it to the Clipboard: fl.getDocumentDOM().getTimeline().cutFrames(4); timeline.deleteLayer()Availability Flash MX 2004. Usage timeline.deleteLayer([index]) Parameters index A zero-based index that specifies the layer to be deleted. If there is only one layer in the timeline, this method has no effect. This parameter is optional. Returns Nothing. Description Method; deletes a layer. If the layer is a folder, all layers within the folder are deleted. If you do not specify the layer index, Flash deletes the currently selected layers. Example The following example deletes the second layer from the top: fl.getDocumentDOM().getTimeline().deleteLayer(1); The following example deletes the currently selected layers: fl.getDocumentDOM().getTimeline().deleteLayer(); timeline.expandFolder()Availability Flash MX 2004. Usage timeline.expandFolder(bExpand [, bRecurseNestedParents [, index]]) Parameters bExpand A Boolean value that, if set to true, causes the method to expand the folder; false causes the method to collapse the folder. bRecurseNestedParents A Boolean value that, if set to true, causes all the layers within the specified folder to be opened or closed, based on the bExpand parameter. This parameter is optional. index A zero-based index of the folder to expand or collapse. Use -1 to apply to all layers (you also must set bRecurseNestedParents to true). This property is equivalent to the Expand All/Collapse All menu items in the Flash authoring tool. This parameter is optional. Returns Nothing. Description Method; expands or collapses the specified folder or folders. If you do not specify a layer, this method operates on the current layer. Example The following examples use this folder structure: Folder 1 *** --layer 7 --Folder 2 **** ----Layer 5 The following example expands Folder 1 only: fl.getDocumentDOM().getTimeline().currentLayer = 1; fl.getDocumentDOM().getTimeline().expandFolder(true); The following example expands Folder 1 only (assuming that Folder 2 collapsed when Folder 1 last collapsed; otherwise, Folder 2 appears expanded): fl.getDocumentDOM().getTimeline().expandFolder(true, false, 0); The following example collapses all folders in the current timeline: fl.getDocumentDOM().getTimeline().expandFolder(false, true, -1); timeline.findLayerIndex()Availability Flash MX 2004. Usage timeline.findLayerIndex(name) Parameters name A string that specifies the name of the layer to find. Returns An array of index values for the specified layer. If the specified layer is not found, Flash returns undefined. Description Method; finds an array of indexes for the layers with the given name. The layer index is flat, so folders are considered part of the main index. Example The following example shows the index values of all layers named Layer 7 in the Output panel: var layerIndex = fl.getDocumentDOM().getTimeline().findLayerIndex("Layer 7"); fl.trace(layerIndex); The following example illustrates how to pass the values returned from this method back to timeline.setSelectedLayers(): var layerIndex = fl.getDocumentDOM().getTimeline().findLayerIndex("Layer 1"); fl.getDocumentDOM().getTimeline().setSelectedLayers(layerIndex[0], true); timeline.frameCountAvailability Flash MX 2004. Usage timeline.frameCount Description Read-only property; an integer that represents the number of frames in this timeline's longest layer. Example The following example uses a countNum variable to store the number of frames in the current document's longest layer: var countNum = fl.getDocumentDOM().getTimeline().frameCount; timeline.getFrameProperty()Availability Flash MX 2004. Usage timeline.getFrameProperty(property [, startframeIndex [, endFrameIndex]]) Parameters property A string that specifies the name of the property for which to get the value. See "Property summary for the Frame object" on page 273 for a complete list of properties. startFrameIndex A zero-based index that specifies the starting frame number for which to get the value. If you omit startFrameIndex, the method uses the current selection. This parameter is optional. endFrameIndex A zero-based index that specifies the end of the range of frames to select. The range goes up to, but does not include, endFrameIndex. If you specify only startFrameIndex, endFrameIndex defaults to the value of startFrameIndex. This parameter is optional. Returns A value for the specified property, or undefined if all the selected frames do not have the same property value. Description Method; retrieves the specified property's value for the selected frames. Example The following example retrieves the name of the first frame in the current document's top layer and displays the name in the Output panel: fl.getDocumentDOM().getTimeline().currentLayer = 0; fl.getDocumentDOM().getTimeline().setSelectedFrames(0, 0, true); var frameName = fl.getDocumentDOM().getTimeline().getFrameProperty("name"); fl.trace(frameName); timeline.getLayerProperty()Availability Flash MX 2004. Usage timeline.getLayerProperty(property) Parameters property A string that specifies the name of the property whose value you want to retrieve. For a list of properties, see "Property summary for the Layer object" on page 305. Returns The value of the specified property. Flash looks at the layer's properties to determine the type. If all the specified layers don't have the same property value, Flash returns undefined. Description Method; retrieves the specified property's value for the selected layers. Example The following example retrieves the name of the top layer in the current document and displays it in the Output panel: fl.getDocumentDOM().getTimeline().currentLayer = 0; var layerName = fl.getDocumentDOM().getTimeline().getLayerProperty("name"); fl.trace(layerName); timeline.getSelectedFrames()Availability Flash MX 2004. Parameters None. Returns An array containing 3n integers, where n is the number of selected regions. The first integer in each group is the layer index, the second integer is the start frame of the beginning of the selection, and the third integer specifies the ending frame of that selection range. The ending frame is not included in the selection. Description Method; retrieves the currently selected frames in an array. Example With the top layer being the current layer, the following example displays 0,5,10,0,20,25 in the Output panel: var timeline = fl.getDocumentDOM().getTimeline(); timeline.setSelectedFrames(5,10); timeline.setSelectedFrames(20,25,false); var theSelectedFrames = timeline.getSelectedFrames(); fl.trace(theSelectedFrames); See also timeline.setSelectedFrames() timeline.getSelectedLayers()Availability Flash MX 2004. Parameters None. Returns An array of the zero-based index values of the selected layers. Description Method; gets the zero-based index values of the currently selected layers. Example The following example displays 1,0 in the Output panel: fl.getDocumentDOM().getTimeline().setSelectedLayers(0); fl.getDocumentDOM().getTimeline().setSelectedLayers(1, false); var layerArray = fl.getDocumentDOM().getTimeline().getSelectedLayers(); fl.trace(layerArray); See also timeline.setSelectedLayers() timeline.insertBlankKeyframe()Availability Flash MX 2004. Usage timeline.insertBlankKeyframe([frameNumIndex]) Parameters frameNumIndex A zero-based index that specifies the frame at which to insert the keyframe. If you omit frameNumIndex, the method uses the current playhead frame number. This parameter is optional. If the specified or selected frame is a regular frame, the keyframe is inserted at the frame. For example, if you have a span of 10 frames numbered 1 10 and you select Frame 5, this method makes Frame 5 a blank keyframe, and the length of the frame span is still 10 frames. If Frame 5 is selected and is a keyframe with a regular frame next to it, this method inserts a blank keyframe at Frame 6. If Frame 5 is a keyframe and the frame next to it is already a keyframe, no keyframe is inserted but the playhead moves to Frame 6. Returns Nothing. Description Method; inserts a blank keyframe at the specified frame index; if the index is not specified, the method inserts the blank keyframe by using the playhead/selection. See also timeline.insertKeyframe(). Example The following example inserts a blank keyframe at Frame 20 (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().insertBlankKeyframe(19); The following example inserts a blank keyframe at the currently selected frame (or playhead location if no frame is selected): fl.getDocumentDOM().getTimeline().insertBlankKeyframe(); timeline.insertFrames()Availability Flash MX 2004. Usage timeline.insertFrames([numFrames [, bAllLayers [, frameNumIndex]]]) Parameters numFrames An integer that specifies the number of frames to insert. If you omit this parameter, the method inserts frames at the current selection in the current layer. This parameter is optional. bAllLayers A Boolean value that, if set to TRue (the default), causes the method to insert the specified number of frames in the numFrames parameter into all layers; if set to false, the method inserts frames into the current layer. This parameter is optional. frameNumIndex A zero-based index that specifies the frame at which to insert a new frame. This parameter is optional. Returns Nothing. Description Method; inserts the specified number of frames at the specified index. If no parameters are specified, this method works as follows:
If parameters are specified, the method works as follows:
If the specified or selected frame is a regular frame, the frame is inserted at that frame. For example, if you have a span of 10 frames numbered 1 10 and you select Frame 5 (or pass a value of 4 for frameIndex), this method adds a frame at Frame 5, and the length of the frame span becomes 11 frames. If Frame 5 is selected and it is a keyframe, this method inserts a frame at Frame 6 regardless of whether the frame next to it is also a keyframe. Example The following example inserts a frame (or frames, depending on the selection) at the current selection in the current layer: fl.getDocumentDOM().getTimeline().insertFrames(); The following example inserts five frames at the current frame in all layers: fl.getDocumentDOM().getTimeline().insertFrames(5); Note If you have multiple layers with frames in them, and you select a frame in one layer when using the previous command, Flash inserts the frames in the selected layer only. If you have multiple layers with no frames selected in them, Flash inserts the frames in all layers. The following example inserts three frames in the current layer only: fl.getDocumentDOM().getTimeline().insertFrames(3, false); The following example inserts four frames in all layers, starting from the first frame: fl.getDocumentDOM().getTimeline().insertFrames(4, true, 0); timeline.insertKeyframe()Availability Flash MX 2004. Usage timeline.insertKeyframe([frameNumIndex]) Parameters frameNumIndex A zero-based index that specifies the frame index at which to insert the keyframe in the current layer. If you omit frameNumIndex, the method uses the frame number of the current playhead or selected frame. This parameter is optional. Returns Nothing. Description Method; inserts a keyframe at the specified frame. If you omit the parameter, the method inserts a keyframe using the playhead or selection location. This method works the same as timeline.insertBlankKeyframe() except that the inserted keyframe contains the contents of the frame it converted (that is, it's not blank). Example The following example inserts a keyframe at the playhead or selected location: fl.getDocumentDOM().getTimeline().insertKeyframe(); The following example inserts a keyframe at Frame 10 of the second layer (remember that index values are different from frame or layer number values): fl.getDocumentDOM().getTimeline().currentLayer = 1; fl.getDocumentDOM().getTimeline().insertKeyframe(9); timeline.layerCountAvailability Flash MX 2004. Usage timeline.layerCount Description Read-only property; an integer that represents the number of layers in the specified timeline. Example The following example uses the NumLayer variable to store the number of layers in the current scene: var NumLayer = fl.getDocumentDOM().getTimeline().layerCount; timeline.layersAvailability Flash MX 2004. Usage timeline.layers Description Read-only property; an array of layer objects. Example The following example uses the currentLayers variable to store the array of layer objects in the current document: var currentLayers = fl.getDocumentDOM().getTimeline().layers; timeline.nameAvailability Flash MX 2004. Usage timeline.name Description Property; a string that specifies the name of the current timeline. This name is the name of the current scene, screen (slide or form), or symbol that is being edited. Example The following example retrieves the first scene name: var sceneName = fl.getDocumentDOM().timelines[0].name; The following example sets the first scene name to FirstScene: fl.getDocumentDOM().timelines[0].name = "FirstScene"; timeline.pasteFrames()Availability Flash MX 2004. Usage timeline.pasteFrames([startFrameIndex [, endFrameIndex]]) Parameters startFrameIndex A zero-based index that specifies the beginning of a range of frames to paste. If you omit startFrameIndex, the method uses the current selection. This parameter is optional. endFrameIndex A zero-based index that specifies the frame at which to stop pasting frames. The method pastes up to, but not including, endFrameIndex. If you specify only startFrameIndex, endFrameIndex defaults to the startFrameIndex value. This parameter is optional. Returns Nothing. Description Method; pastes the range of frames from the Clipboard into the specified frames. Example The following example pastes the frames on the Clipboard to the currently selected frame or playhead location: fl.getDocumentDOM().getTimeline().pasteFrames(); The following example pastes the frames on the Clipboard at Frame 2 up to, but not including, Frame 10 (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().pasteFrames(1, 9); The following example pastes the frames on the Clipboard starting at Frame 5: fl.getDocumentDOM().getTimeline().pasteFrames(4); timeline.removeFrames()Availability Flash MX 2004. Usage timeline.removeFrames([startFrameIndex [, endFrameIndex]]) Parameters startFrameIndex A zero-based index that specifies the first frame at which to start removing frames. If you omit startFrameIndex, the method uses the current selection; if there is no selection, all frames at the current playhead on all layers are removed. This parameter is optional. endFrameIndex A zero-based index that specifies the frame at which to stop removing frames; the range of frames goes up to, but does not include, endFrameIndex. If you specify only startFrameIndex, endFrameIndex defaults to the startFrameIndex value. This parameter is optional. Returns Nothing. Description Method; deletes the frame. Example The following example deletes Frame 5 up to, but not including, Frame 10 of the top layer in the current scene (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().currentLayer = 0; fl.getDocumentDOM().getTimeline().removeFrames(4, 9); The following example deletes Frame 8 on the top layer in the current scene: fl.getDocumentDOM().getTimeline().currentLayer = 0; fl.getDocumentDOM().getTimeline().removeFrames(7); timeline.reorderLayer()Availability Flash MX 2004. Usage timeline.reorderLayer(layerToMove, layerToPutItBy [, bAddBefore]) Parameters layerToMove A zero-based index that specifies which layer to move. layerToPutItBy A zero-based index that specifies which layer you want to move the layer next to. For example, if you specify 1 for layerToMove and 0 for layerToPutItBy, the second layer is placed next to the first layer. bAddBefore Specifies whether to move the layer before or after layerToPutItBy. If you specify false, the layer is moved after layerToPutItBy. The default value is TRue. This parameter is optional. Returns Nothing. Description Method; moves the first specified layer before or after the second specified layer. Example The following example moves the layer at index 2 to the top (on top of the layer at index 0): fl.getDocumentDOM().getTimeline().reorderLayer(2, 0); The following example places the layer at index 3 after the layer at index 5: fl.getDocumentDOM().getTimeline().reorderLayer(3, 5, false); timeline.reverseFrames()Availability Flash MX 2004. Usage timeline.reverseFrames([startFrameIndex [, endFrameIndex]]) Parameters startFrameIndex A zero-based index that specifies the first frame at which to start reversing frames. If you omit startFrameIndex, the method uses the current selection. This parameter is optional. endFrameIndex A zero-based index that specifies the first frame at which to stop reversing frames; the range of frames goes up to, but does not include, endFrameIndex. If you specify only startFrameIndex, endFrameIndex defaults to the value of startFrameIndex. This parameter is optional. Returns Nothing. Description Method; reverses a range of frames. Example The following example reverses the positions of the currently selected frames: fl.getDocumentDOM().getTimeline().reverseFrames(); The following example reverses frames from Frame 10 up to, but not including, Frame 15 (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().reverseFrames(9, 14); timeline.selectAllFrames()Availability Flash MX 2004. Usage timeline.selectAllFrames() Parameters None. Returns Nothing. Description Method; selects all the frames in the current timeline. Example The following example selects all the frames in the current timeline. fl.getDocumentDOM().getTimeline().selectAllFrames(); timeline.setFrameProperty()Availability Flash MX 2004. Usage timeline.setFrameProperty(property, value [, startFrameIndex [, endFrameIndex]]) Parameters property A string that specifies the name of the property to be modified. For a complete list of properties and values, see "Property summary for the Frame object" on page 273. Note You can't use this method to set values for read-only properties such as frame.duration and frame.elements. value Specifies the value to which you want to set the property. To determine the appropriate values and type, see "Property summary for the Frame object" on page 273. startFrameIndex A zero-based index that specifies the starting frame number to modify. If you omit startFrameIndex, the method uses the current selection. This parameter is optional. endFrameIndex A zero-based index that specifies the first frame at which to stop. The range of frames goes up to, but does not include, endFrameIndex. If you specify startFrameIndex but omit endFrameIndex, endFrameIndex defaults to the value of startFrameIndex. This parameter is optional. Returns Nothing. Description Method; sets the property of the Frame object for the selected frames. Example The following example assigns the ActionScript stop() command to the first frame of the top layer in the current document: fl.getDocumentDOM().getTimeline().currentLayer = 0; fl.getDocumentDOM().getTimeline().setSelectedFrames(0,0,true); fl.getDocumentDOM().getTimeline().setFrameProperty("actionScript", "stop();"); The following example sets a motion tween from Frame 2 up to, but not including, Frame 5, of the current layer (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().setFrameProperty("tweenType","motion",1,4 ); timeline.setLayerProperty()Availability Flash MX 2004. Usage timeline.setLayerProperty(property, value [, layersToChange]) Parameters property A string that specifies the property to set. For a list of properties, see "Layer object" on page 305. value The value to which you want to set the property. Use the same type of value you would use when setting the property in the layer object. layersToChange A string that identifies which layers should be modified. Acceptable values are "selected", "all", and "others". The default value is "selected" if you omit this parameter. This parameter is optional. Returns Nothing. Description Method; sets the specified property on all the selected layers to a specified value. Example The following example makes the selected layer(s) invisible: fl.getDocumentDOM().getTimeline().setLayerProperty("visible", false); The following example sets the name of the selected layer(s) to "selLayer": fl.getDocumentDOM().getTimeline().setLayerProperty("name", "selLayer"); timeline.setSelectedFrames()Availability Flash MX 2004. Usage timeline.setSelectedFrames(startFrameIndex, endFrameIndex [, bReplaceCurrentSelection]) timeline.setSelectedFrames(selectionList [, bReplaceCurrentSelection]) Parameters startFrameIndex A zero-based index that specifies the beginning frame to set. endFrameIndex A zero-based index that specifies the end of the selection; endFrameIndex is the frame after the last frame in the range to select. bReplaceCurrentSelection A Boolean value that, if it is set to true, causes the currently selected frames to be deselected before the specified frames are selected. The default value is TRue. selectionList An array of three integers, as returned by timeline.getSelectedFrames(). Returns Nothing. Description Method; selects a range of frames in the current layer or sets the selected frames to the selection array passed into this method. Example The following example selects the top layer, Frame 1, up to, but not including, Frame 10; it then adds Frame 12 up to, but not including, Frame 15 on the same layer to the current selection (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().setSelectedFrames(0, 9); fl.getDocumentDOM().getTimeline().setSelectedFrames(11, 14, false); The following example first stores the array of selected frames in the savedSelectionList variable, and then uses the array later in the code to reselect those frames after a command or user interaction has changed the selection: var savedSelectionList = fl.getDocumentDOM().getTimeline().getSelectedFrames(); // Do something that changes the selection. fl.getDocumentDOM().getTimeline().setSelectedFrames(savedSelectionList); The following example selects the top layer, Frame 1, up to, but not including, Frame 10, then adds Frame 12, up to, but not including, Frame 15, on the same layer to the current selection: fl.getDocumentDOM().getTimeline().setSelectedFrames([0, 0, 9]); fl.getDocumentDOM().getTimeline().setSelectedFrames([0, 11, 14], false); See also timeline.getSelectedFrames() timeline.setSelectedLayers()Availability Flash MX 2004. Usage timeline.setSelectedLayers(index [, bReplaceCurrentSelection]) Parameters index A zero-based index for the layer to select. bReplaceCurrentSelection A Boolean value that, if it is set to TRue, causes the method to replace the current selection; false causes the method to extend the current selection. The default value is true. This parameter is optional. Returns Nothing. Description Method; sets the layer to be selected, and also makes the specified layer the current layer. Selecting a layer also means that all the frames in the layer are selected. Example The following example selects the top layer: fl.getDocumentDOM().getTimeline().setSelectedLayers(0); The following example adds the next layer to the selection: fl.getDocumentDOM().getTimeline().setSelectedLayers(1, false); See also timeline.getSelectedLayers() timeline.showLayerMasking()Availability Flash MX 2004. Usage timeline.showLayerMasking([layer]) Parameters layer A zero-based index of a mask or masked layer to show masking during authoring. This parameter is optional. Returns Nothing. Description Method; shows the layer masking during authoring by locking the mask and masked layers. This method uses the current layer if no layer is specified. If you use this method on a layer that is not of type Mask or Masked, Flash displays an error in the Output panel. Example The following example specifies that the layer masking of the first layer should show during authoring. fl.getDocumentDOM().getTimeline().showLayerMasking(0); |
< Day Day Up > |