03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

this.createTextField("status_txt", this.getNextHighestDepth(), 200, 10,<br />

300, 100);<br />

status_txt.html = true;<br />

status_txt.multiline = true;<br />

var someListener:Object = new Object();<br />

someListener.onSetFocus = function(oldFocus, newFocus) {<br />

status_txt.htmlText = "setFocus triggered";<br />

status_txt.htmlText += "";<br />

status_txt.htmlText += "&nbsp;\toldFocus:\t"+oldFocus;<br />

status_txt.htmlText += "&nbsp;\tnewFocus:\t"+newFocus;<br />

status_txt.htmlText += "&nbsp;\tgetFocus:\t"+Selection.getFocus();<br />

status_txt.htmlText += "";<br />

};<br />

Selection.addListener(someListener);<br />

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player<br />

7 or later. If your SWF file includes a version 2 component, use the version 2 components'<br />

DepthManager class instead of the MovieClip.getNextHighestDepth() method.<br />

See also<br />

addListener (Selection.addListener method), setFocus (Selection.setFocus<br />

method)<br />

removeListener (Selection.removeListener method)<br />

public static removeListener(listener:Object) : Boolean<br />

Removes an object previously registered with Selection.addListener().<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6<br />

Parameters<br />

listener:Object - The object that will no longer receive focus notifications.<br />

Returns<br />

Boolean - If listener was successfully removed, the method returns a true value. If<br />

listener was not successfully removed--for example, if listener was not on the Selection<br />

object's listener list--the method returns a value of false.<br />

Example<br />

The following <strong>ActionScript</strong> dynamically creates several text field instances. When you select a<br />

text field, information displays in the Output panel. When you click the remove_btn<br />

instance, the listener is removed <strong>and</strong> information no longer displays in the Output panel.<br />

Selection 1091

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

Saved successfully!

Ooh no, something went wrong!