All the objects in the DOM that aren't listed in the previous table (see
Object Model" on page
library of a document, you use the
library
object:
fl.getDocumentDOM().library
To access the array of items in the library, you use the
element in the array is an
fl.getDocumentDOM().library.items
To access a particular item in the library, you specify a member of the
fl.getDocumentDOM().library.items[0]
In other words, the
child of the
Library
Specifying the target of an action
Unless otherwise specified, methods affect the current focus or selection. For example, the
following script doubles the size of the current selection because no particular object is specified:
fl.getDocumentDOM().scaleSelection(2, 2);
In some cases, you might want an action to specifically target the currently selected item in the
Flash document. To do this, use the array that the
first element in the array represents the currently selected item, as shown in the following
example:
var accDescription = fl.getDocumentDOM().selection[0].description;
The following script doubles the size of the first element on the Stage that is stored in the element
array, instead of the current selection:
var element =
fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0];
if (element) {
element.width = element.width*2;
element.height = element.height*2;
}
You can also do something such as loop through all the elements on the Stage and increase the
width and height by a specified amount, as shown in the following example:
var elementArray =
fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements;
for (var i=0; i < elementArray.length; i++) {
var offset = 10;
elementArray[i].width += offset;
elementArray[i].height += offset;
}
19) are accessed from the
library
Item
object:
object is a child of the
Library
object.
object. For example, to access the
Document
property of the
Document
property of the
items
object, and the
Document
Document.selection
The Flash Document Object Model
"The Flash Document
object, which retrieves a
object; each
Library
array:
items
object is a
Item
property contains. The
21
Need help?
Do you have a question about the FLASH MX 2004-FLASH JAVASCRIPT DICTIONARY and is the answer not in the manual?