beautypg.com

Document.selectnone() – Adobe Extending Flash Professional CS5 User Manual

Page 160

background image

138

EXTENDING FLASH PROFESSIONAL

Document object

Last updated 5/2/2011

// Assigns the layers array to the variable "theLayers".

var theLayers = fl.getDocumentDOM().getTimeline().layers;

// Creates an array to hold all the elements

// that are instances of "myMovieClip".

var myArray = new Array();

// Counter variable

var x = 0;

// Begin loop through all the layers.

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

// Gets the array of elements in Frame 1

// and assigns it to the array "theElems".

var theElems = theLayers[i].frames[0].elements;

// Begin loop through the elements on a layer.

for (var c = 0; c < theElems.length; c++) {

// Checks to see if the element is of type "instance".

if (theElems[c].elementType == "instance") {

// If the element is an instance, it checks

// if it is an instance of "myMovieClip".

if (theElems[c].libraryItem.name == "myMovieClip") {

// Assigns elements that are instances of "myMovieClip" to "myArray".

myArray[x] = theElems[c];

// Increments counter variable.

x++;

}

}

}

}

// Now that you have assigned all the instances of "myMovieClip"

// to "myArray", you then set the document.selection array

// equal to myArray. This selects the objects on the Stage.

fl.getDocumentDOM().selection = myArray;

document.selectNone()

Availability
Flash MX 2004.

Usage

document.selectNone()

Parameters
None.

Returns
Nothing.

Description
Method; deselects any selected items.

Example
The following example deselects any items that are selected:

This manual is related to the following products: