beautypg.com

Document.name – Adobe Extending Flash Professional CS5 User Manual

Page 144

background image

122

EXTENDING FLASH PROFESSIONAL

Document object

Last updated 5/2/2011

Usage

document.moveSelectionBy(distanceToMove)

Parameters

distanceToMove

A pair of floating-point values that specify the x and y coordinate values by which the method

moves the selection. For example, passing ({

x:1,y:2

}) specifies a location one pixel to the right and two pixels down

from the current location.

Returns
Nothing.

Description
Method; moves selected objects by a specified distance.

Note: When the user uses the arrow keys to move the item, the History panel combines all presses of the arrow key as one
move step. When the user presses the arrow keys repeatedly, rather than taking multiple steps in the History panel, the
method performs one step, and the arguments are updated to reflect the repeated arrow keys.

For information on making a selection, see

document.setSelectionRect()

,

document.mouseClick()

,

document.mouseDblClk()

, and the

Element object

.

Example
The following example moves the selected item 62 pixels to the right and 84 pixels down:

fl.getDocumentDOM().moveSelectionBy({x:62, y:84});

document.name

Availability
Flash MX 2004.

Usage

document.name

Description
Read-only property; a string that represents the name of a document (FLA file).

Example
The following example sets the variable

fileName

to the filename of the first document in the documents array:

var fileName = flash.documents[0].name;

The following example displays the names of all the open documents in the Output panel:

var openDocs = fl.documents;

for(var i=0;i < openDocs.length; i++){

fl.trace(i + " " + openDocs[i].name +"\n");

}

This manual is related to the following products: