03.07.2013 Views

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

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.

emoveListener (métho<strong>de</strong> Selection.removeListener)<br />

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

Supprime un objet précé<strong>de</strong>mment enregistré avec Selection.addListener().<br />

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

Paramètres<br />

listener:Object - Objet qui ne recevra plus <strong>de</strong> notifications <strong>de</strong> focus.<br />

Valeur renvoyée<br />

Boolean - Si listener a été supprimé avec succès, la métho<strong>de</strong> renvoie une valeur true. Si<br />

l'écouteur listener n'a pas été supprimé avec succès (par exemple, si listener n'était pas<br />

sur la liste d'écouteurs <strong>de</strong> l'objet <strong>de</strong> la Sélection, la métho<strong>de</strong> renvoie une valeur <strong>de</strong> false.<br />

Exemple<br />

Le co<strong>de</strong> <strong>ActionScript</strong> suivant crée <strong>de</strong> façon dynamique plusieurs occurrences <strong>de</strong> champ texte.<br />

Lorsque vous sélectionnez un champ texte, les informations correspondantes s'affichent dans<br />

le panneau <strong>de</strong> sortie. Lorsque vous cliquez sur l'occurrence remove_btn, l'écouteur est<br />

supprimé et aucune information ne s'affiche dans le panneau <strong>de</strong> sortie.<br />

this.createTextField("one_txt", 1, 0, 0, 100, 22);<br />

this.createTextField("two_txt", 2, 0, 25, 100, 22);<br />

this.createTextField("three_txt", 3, 0, 50, 100, 22);<br />

this.createTextField("four_txt", 4, 0, 75, 100, 22);<br />

for (var i in this) {<br />

if (this[i] instanceof TextField) {<br />

this[i].bor<strong>de</strong>r = true;<br />

this[i].type = "input";<br />

}<br />

}<br />

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

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

trace("Focus shifted from "+oldFocus+" to "+newFocus);<br />

};<br />

Selection.addListener(selectionListener);<br />

remove_btn.onRelease = function() {<br />

trace("removeListener invoked");<br />

Selection.removeListener(selectionListener);<br />

};<br />

Sélection 1115

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

Saved successfully!

Ooh no, something went wrong!