Frame.duration, Frame.elements – Adobe Extending Flash Professional CS5 User Manual
Page 310

288
EXTENDING FLASH PROFESSIONAL
Frame object
Last updated 5/2/2011
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.duration
Availability
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 the first frame in the top layer in
the
frameSpan
variable:
var frameSpan = fl.getDocumentDOM().getTimeline().layers[0].frames[0].duration;
frame.elements
Availability
Flash MX 2004.
Usage
frame.elements
Description
Read-only property; an array of Element objects (see
). 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. To work around this issue, select each shape individually and group it .
Example
The following example stores an array of current elements in the top layer, first frame in the
myElements
variable: