_name (MovieClip._name property)

public _name : String

The instance name of the movie clip.

Availability: ActionScript 1.0; Flash Player 4

Example

The following example lets you right-click (Windows) or Control-click (Macintosh) a movie clip on the Stage and select Info from the context menu to view information about that instance. Add several movie clips with instance names, and then add the following ActionScript to your AS or FLA file:

var menu_cm:ContextMenu = new ContextMenu();
menu_cm.customItems.push(new ContextMenuItem("Info...", getMCInfo));
function getMCInfo(target_mc:MovieClip, obj:Object) {
    trace("You clicked on the movie clip '"+target_mc._name+"'.");
    trace("\t width:"+target_mc._width+", height:"+target_mc._height);
    trace("");
}
for (var i in this) {
    if (typeof (this[i]) == 'movieclip') {
    this[i].menu = menu_cm;
    }
}

See also

_name (Button._name property)


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00001940.html