03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

_target (Button._target property)<br />

public _target : String [read-only]<br />

Returns the target path of the button instance specified by my_btn.<br />

Example<br />

Add a button instance to the Stage with an instance name my_btn <strong>and</strong> add the following code<br />

to Frame 1 of the Timeline:<br />

trace(my_btn._target); //displays /my_btn<br />

Select my_btn <strong>and</strong> convert it to a movie clip. Give the new movie clip an instance name<br />

my_mc. Delete the existing ActionScript in Frame 1 of the Timeline <strong>and</strong> replace it with:<br />

my_mc.my_btn.onRelease = function(){<br />

trace(this._target); //displays /my_mc/my_btn<br />

};<br />

To convert the notation from slash notation to dot notation, modify the previous code<br />

example to the following:<br />

my_mc.my_btn.onRelease = function(){<br />

trace(eval(this._target)); //displays _level0.my_mc.my_btn<br />

};<br />

This lets you access methods <strong>and</strong> parameters of the target object, such as:<br />

my_mc.my_btn.onRelease = function(){<br />

var target_btn:Button = eval(this._target);<br />

trace(target_btn._name); //displays my_btn<br />

};<br />

See also<br />

_target (MovieClip._target property)<br />

trackAsMenu (Button.trackAsMenu property)<br />

public trackAsMenu : Boolean<br />

A Boolean value that indicates whether other buttons or movie clips can receive a release event<br />

from a mouse or stylus. If you drag a stylus or mouse pointer across a button <strong>and</strong> then release<br />

it on a second button, the onRelease event is registered for the second button. This allows<br />

you to create menus for the second button. You can set the trackAsMenu property on any<br />

button or movie clip object. If you have not defined the trackAsMenu property, the default<br />

behavior is false.<br />

You can change the trackAsMenu property at any time; the modified button immediately<br />

takes on the new behavior.<br />

Button 271

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!