Element.getpersistentdata() – Adobe Extending Flash Professional CS4 User Manual
Page 210
188
EXTENDING FLASH CS4 PROFESSIONAL
Element object
Description
Read-only property; a string that represents the type of the specified element. The value is one of the following:
"shape"
,
"text"
,
"instance"
, or
"shapeObj"
. A
"shapeObj"
is created with an extensible tool.
Example
The following example stores the type of the first element in the
eType
variable:
// In a new file, place a movie clip on first frame top layer, and
// then run this line of script.
var eType = fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0].elementType; //
eType = instance
The following example displays several properties for all the elements in the current layer or frame:
var tl = fl.getDocumentDOM().getTimeline()
var elts = tl.layers[tl.currentLayer].frames[tl.currentFrame].elements;
for (var x = 0; x < elts.length; x++) {
var elt = elts[x];
fl.trace("Element "+ x +" Name = " + elt.name + " Type = " + elt.elementType + " location
= " + elt.left + "," + elt.top + " Depth = " + elt.depth);
}
element.getPersistentData()
Availability
Flash MX 2004.
Usage
element.getPersistentData(name)
Parameters
name
A string that identifies the data to be returned.
Returns
The data specified by the name parameter, or 0 if the data doesn’t exist.
Description
Method; retrieves the value of the data specified by the name parameter. The type of data depends on the type of the
data that was stored (see
). Only symbols and bitmaps support persistent data.
Example
The following example sets and gets data for the specified element, shows its value in the Output panel, and then
removes the data: