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.

Voir également<br />

getEndIn<strong>de</strong>x (métho<strong>de</strong> Selection.getEndIn<strong>de</strong>x)<br />

getCaretIn<strong>de</strong>x (métho<strong>de</strong> Selection.getCaretIn<strong>de</strong>x)<br />

public static getCaretIn<strong>de</strong>x() : Number<br />

Renvoie l'in<strong>de</strong>x <strong>de</strong> la position <strong>du</strong> point d'insertion clignotant (caret). Si aucun point<br />

d'insertion clignotant ne s'affiche, la métho<strong>de</strong> renvoie -1. Les in<strong>de</strong>x <strong>de</strong> plages <strong>de</strong> sélection sont<br />

basés sur zéro (par exemple, la première position est 0, la <strong>de</strong>uxième position est 1, etc.).<br />

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

Valeur renvoyée<br />

Number - Entier.<br />

Exemple<br />

L'exemple suivant crée et définit les propriétés d'un champ texte lors <strong>de</strong> l'exécution. La<br />

métho<strong>de</strong> getCaretIn<strong>de</strong>x() permet <strong>de</strong> renvoyer l'in<strong>de</strong>x <strong>du</strong> signe circonflexe et affiche sa<br />

valeur dans un autre champ texte.<br />

this.createTextField("pos_txt", this.getNextHighestDepth(), 50, 20, 100,<br />

22);<br />

this.createTextField("content_txt", this.getNextHighestDepth(), 50, 50,<br />

400, 300);<br />

content_txt.bor<strong>de</strong>r = true;<br />

content_txt.type = "input";<br />

content_txt.wordWrap = true;<br />

content_txt.multiline = true;<br />

content_txt.onChanged = getCaretPos;<br />

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

keyListener.onKeyUp = getCaretPos;<br />

Key.addListener(keyListener);<br />

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

mouseListener.onMouseUp = getCaretPos;<br />

Mouse.addListener(mouseListener);<br />

function getCaretPos() {<br />

pos_txt.text = Selection.getCaretIn<strong>de</strong>x();<br />

}<br />

1110 Chapitre 2: Classes <strong>ActionScript</strong>

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

Saved successfully!

Ooh no, something went wrong!