< Day Day Up > |
Availability Flash MX 2004. Description The Frame object represents frames in the layer. Method summary for the Frame objectThe following methods can be used with the Frame object.
Property summary for the Frame objectThe following properties can be used with the Frame object:
frame.actionScriptAvailability Flash MX 2004. Usage frame.actionScript Description Property; a string that represents ActionScript code. To insert a new line character, use "\\n". Example The following example assigns stop() to first frame top layer action: fl.getDocumentDOM().getTimeline().layers[0].frames[0].actionScript = 'stop();'; frame.durationAvailability Flash MX 2004. Usage frame.duration Description Read-only property; an integer that represents the number of frames in a frame sequence. Example The following example stores the number of frames in a frame sequence that starts at first frame in the top layer in the frameSpan variable: var frameSpan = fl.getDocumentDOM().getTimeline().layers[0].frames[0].duration; frame.elementsAvailability Flash MX 2004. Usage frame.elements Description Read-only property; an array of Element objects (see Element object). The order of elements is the order in which they are stored in the FLA file. If there are multiple shapes on the Stage, and each is ungrouped, Flash treats them as one element. If each shape is grouped, so there are multiple groups on the Stage, Flash sees them as separate elements. In other words, Flash treats raw, ungrouped shapes as a single element, regardless of how many separate shapes are on the Stage. If a frame contains three raw, ungrouped shapes, for example, then elements.length in that frame returns a value of 1. Select each shape individually, and group it to work around this issue. Example The following example stores an array of current elements on the top layer, first frame in the myElements variable: var myElements = fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements; frame.getCustomEase()Availability Flash 8. Usage Frame.getCustomEase( [ property ] ) Parameters property An optional string that specifies the property for which you want to return the custom ease value. Acceptable values are "all", "position", "rotation", "scale", "color", and "filters". The default value is "all". Returns Returns an array of JavaScript objects, each of which has an x and y property. Description Method; returns an array of objects that represent the control points for the cubic Bézier curve that defines the ease curve. Example The following example returns the custom ease value of the position property for the first frame in the top layer: var theFrame = fl.getDocumentDOM().getTimeline().layers[0].frames[0] var easeArray = theFrame.getCustomEase( "position" ); See also frame.hasCustomEase, frame.setCustomEase(), frame.useSingleEaseCurve frame.hasCustomEaseAvailability Flash 8. Usage frame.hasCustomEase Description Property; a Boolean value. If true, the frame gets its ease information from the custom ease curve. If false, the frame gets its ease information from the ease value. Example The following example specifies that the first frame in the top layer should get its ease information from the ease value rather than the custom ease curve: var theFrame = fl.getDocumentDOM().getTimeline().layers[0].frames[0] theFrame.hasCustomEase = false; See also frame.getCustomEase(), frame.setCustomEase(), frame.useSingleEaseCurve frame.labelTypeAvailability Flash MX 2004. Usage frame.labelType Description Property; a string that specifies the type of Frame name. Acceptable values are "none", "name", "comment", and "anchor". Setting a label to "none" clears the frame.name property. Example The following example sets the name of the first frame in the top layer to "First Frame" and then sets its label to "comment": fl.getDocumentDOM().getTimeline().layers[0].frames[0].name = 'First Frame'; fl.getDocumentDOM().getTimeline().layers[0].frames[0].labelType = 'comment'; frame.motionTweenOrientToPathAvailability Flash MX 2004. Usage frame.motionTweenOrientToPath Description Property; a Boolean value; specifies whether the tweened element rotates the element as it moves along a path to maintain its angle with respect to each point on the path (TRue) or whether it does not rotate (false). If you want to specify a value for this property, you should set frame.motionTweenRotate to "none". frame.motionTweenRotateAvailability Flash MX 2004. Usage frame.motionTweenRotate Description Property; a string that specifies how the tweened element rotates. Acceptable values are "none", "auto", "clockwise", and "counter-clockwise". A value of "auto" means the object will rotate in the direction requiring the least motion to match the rotation of the object in the following keyframe. If you want to specify a value for frame.motionTweenOrientToPath, set this property to "none". Example See frame.motionTweenRotateTimes. frame.motionTweenRotateTimesAvailability Flash MX 2004. Usage frame.motionTweenRotateTimes Description Property; an integer that specifies the number of times the tweened element rotates between the starting keyframe and the next keyframe. Example The following example rotates the element in this frame counter-clockwise three times by the time it reaches the next keyframe: fl.getDocumentDOM().getTimeline().layers[0].frames[0].motionTweenRotate = "counter-clockwise"; fl.getDocumentDOM().getTimeline().layers[0].frames[0].motionTweenRotateTime s = 3; frame.motionTweenScaleAvailability Flash MX 2004. Usage frame.motionTweenScale Description Property; a Boolean value; specifies whether the tweened element scales to the size of the object in the following keyframe, increasing its size with each frame in the tween (true) or doesn't scale (false). Example The following example specifies that the tweened element should scale to the size of the object in the following keyframe, increasing its size with each frame in the tween. fl.getDocumentDOM().getTimeline().layers[0].frames[0].motionTweenScale = true; frame.motionTweenSnapAvailability Flash MX 2004. Usage frame.motionTweenSnap Description Property; a Boolean value; specifies whether the tweened element automatically snaps to the nearest point on the motion guide layer associated with this frame's layer (TRue) or not (false). frame.motionTweenSyncAvailability Flash MX 2004. Usage frame.motionTweenSync Description Property; a Boolean value; if set to true, synchronizes the animation of the tweened object with the main timeline. Example The following example specifies that tweened object should be synchronized with the timeline: fl.getDocumentDOM().getTimeline().layers[0].frames[0].motionTweenSync = true; frame.nameAvailability Flash MX 2004. Usage frame.name Description Property; a string that specifies the name of the frame. Example The following example sets the name of the first frame, top layer to "First Frame" and then stores the name value in the frameLabel variable: fl.getDocumentDOM().getTimeline().layers[0].frames[0].name = 'First Frame'; var frameLabel = fl.getDocumentDOM().getTimeline().layers[0].frames[0].name; frame.setCustomEase()Availability Flash 8. Usage frame.setCustomEase( property, easeCurve ) Parameters property A string that specifies the property the ease curve should be used for. Acceptable values are "all", "position", "rotation", "scale", "color", and "filters". easeCurve An array of objects that defines the ease curve. Each array element must be a JavaScript object with x and y properties. Returns Nothing. Description Method; specifies an array of control point and tangent endpoint coordinates that describe a cubic Bézier curve to be used as a custom ease curve. This array is constructed by the horizontal (ordinal: left to right) position of the control points and tangent endpoints. For example, the following illustration shows an ease curve that would be created if the easeCurve array contained values for the seven points shown as p1 through p7:
Example The following example sets the ease curve for all properties of the first frame on the first layer to the Bézier curve specified by the control points and tangent end points stored in the myCurve array: var theFrame = fl.getDocumentDOM().getTimeline().layers[0].frames[0] var myCurve = [{x:100, y:200},{x:200, y:100}, {x:10, y:0}] theFrame.setCustomEase("all", myCurve); See also frame.getCustomEase(), frame.hasCustomEase, frame.useSingleEaseCurve frame.shapeTweenBlendAvailability Flash MX 2004. Usage frame.shapeTweenBlend Description Property; a string that specifies how a shape tween is blended between the shape in the keyframe at the start of the tween and the shape in the following keyframe. Acceptable values are "distributive" and "angular". frame.soundEffectAvailability Flash MX 2004. Usage frame.soundEffect Description Property; a string that specifies effects for a sound that is attached directly to a frame (frame.soundLibraryItem). Acceptable values are "none", "left channel", "right channel", "fade left to right", "fade right to left", "fade in", "fade out", and "custom". Example The following example specifies that the sound attached to the first frame should fade in: fl.getDocumentDOM().getTimeline().layers[0].frames[0].soundEffect = "fade in"; frame.soundLibraryItemAvailability Flash MX 2004. Usage frame.soundLibraryItem Description Property; a library item (see SoundItem object) used to create a sound. The sound is attached directly to the frame. Example The following example assigns the first item in the library to the soundLibraryItem property of the first frame: // The first item in the library must be a sound object fl.getDocumentDOM().getTimeline().layers[0].frames[0].soundLibraryItem =fl.getDocumentDOM().library.items[0]; frame.soundLoopAvailability Flash MX 2004. Usage frame.soundLoop Description Property; an integer value that specifies the number of times a sound that is attached directly to a frame (frame.soundLibraryItem) plays. If you want to specify a value for this property, set frame.soundLoopMode to "repeat". Example See frame.soundLoopMode. frame.soundLoopModeAvailability Flash MX 2004. Usage frame.soundLoopMode Description Property; a string that specifies whether a sound that is attached directly to a frame (frame.soundLibraryItem) should play a specific number of times or loop indefinitely. Acceptable values are "repeat" and "loop". To specify the number of times the sound should play, set a value for frame.soundLoop. Example The following example specifies that a sound should play two times: fl.getDocumentDOM().getTimeline().layers[0].frames[0].soundLoopMode = "repeat"; fl.getDocumentDOM().getTimeline().layers[0].frames[0].soundLoop = 2; frame.soundNameAvailability Flash MX 2004. Usage frame.soundName Description Property; a string that specifies the name of a sound that is attached directly to a frame (frame.soundLibraryItem), as stored in the library. Example The following example changes the soundName property of the first frame to "song1.mp3"; song1.mp3 must exist in the library: fl.getDocumentDOM().getTimeline().layers[0].frames[0].soundName = "song1.mp3"; frame.soundSyncAvailability Flash MX 2004. Usage frame.soundSync Description Property; a string that specifies the sync behavior of a sound that is attached directly to a frame (frame.soundLibraryItem). Acceptable values are "event", "stop", "start", and "stream". Example The following example specifies that a sound should stream: fl.getDocumentDOM().getTimeline().layers[0].frames[0].soundSync = 'stream'; frame.startFrameAvailability Flash MX 2004. Usage frame.startFrame Description Read-only property; the index of the first frame in a sequence. Example In the following example, stFrame is the index of the first frame in the frame sequence. In this example, a frame sequence is spanning the six frames from Frame 5 to Frame 10. Therefore, the value of stFrame at any frame between Frame 5 and Frame 10 is 4 (remember that index values are different from frame number values). var stFrame = fl.getDocumentDOM().getTimeline().layers[0].frames[4].startFrame; fl.trace(stFrame); // 4 var stFrame = fl.getDocumentDOM().getTimeline().layers[0].frames[9].startFrame; fl.trace(stFrame); // 4 frame.tweenEasingAvailability Flash MX 2004. Usage frame.tweenEasing Description Property; an integer that specifies the amount of easing that should be applied to the tweened object. Acceptable values are -100 to 100. To begin the motion tween slowly and accelerate the tween toward the end of the animation, use a value between -1 and -100. To begin the motion tween rapidly and decelerate the tween toward the end of the animation, use a positive value between 1 and 100. Example The following example specifies that the motion of the tweened object should begin fairly rapidly and decelerate toward the end of the animation: fl.getDocumentDOM().getTimeline().layers[0].frames[0].tweenEasing = 50; frame.tweenTypeAvailability Flash MX 2004. Usage frame.tweenType Description Property; a string that specifies the type of tween; acceptable values are "motion", "shape", or "none". The value "none" removes the motion tween. Use the timeline.createMotionTween() method to create a tween. If you specify "motion", the object in the frame must be a symbol, text field, or grouped object. It will be tweened from its location in the current keyframe to the location in the following keyframe. If you specify "shape", the object in the frame must be a shape. It will blend from its shape in the current keyframe to the shape in the following keyframe. Example The following example specifies that the object is a motion tween, and therefore, it should be tweened from its location in the current keyframe to the location in the following keyframe: fl.getDocumentDOM().getTimeline().layers[0].frames[0].tweenType = "motion"; frame.useSingleEaseCurveAvailability Flash 8. Usage frame.useSingleEaseCurve Description Property; a Boolean value. If TRue, a single custom ease curve is used for easing information for all properties. If false, each property has its own ease curve. This property is ignored if the frame doesn't have custom easing applied. Example The following example specifies that a single custom ease curve should be used for all properties of the first frame on the first layer: var theFrame = fl.getDocumentDOM().getTimeline().layers[0].frames[0] theFrame.useSingleEaseCurve = true; See also frame.getCustomEase(), frame.hasCustomEase, frame.setCustomEase() |
< Day Day Up > |