Flash Lite 2 |
|||
| Guide de référence du langage ActionScript Flash Lite 2.x > Classes ActionScript > TextField > _width (propriété TextField._width) | |||
public _width : Number
Largeur du champ texte, en pixels.
Disponibilité : ActionScript 1.0 ; Flash Lite 2.0
L'exemple suivant crée deux fichiers texte que vous pouvez utiliser pour modifier la largeur et la hauteur d'un troisième champ texte sur la Scène. Ajoutez le code ActionScript suivant à un fichier FLA ou ActionScript.
this.createTextField("my_txt", this.getNextHighestDepth(), 10, 40, 160, 120);
my_txt.background = true;
my_txt.backgroundColor = 0xFF0000;
my_txt.border = true;
my_txt.multiline = true;
my_txt.type = "input";
my_txt.wordWrap = true;
this.createTextField("width_txt", this.getNextHighestDepth(), 10, 10, 30, 20);
width_txt.border = true;
width_txt.maxChars = 3;
width_txt.type = "input";
width_txt.text = my_txt._width;
width_txt.onChanged = function() {
my_txt._width = this.text;
}
this.createTextField("height_txt", this.getNextHighestDepth(), 70, 10, 30, 20);
height_txt.border = true;
height_txt.maxChars = 3;
height_txt.type = "input";
height_txt.text = my_txt._height;
height_txt.onChanged = function() {
my_txt._height = this.text;
}
Lorsque vous testez cet exemple, essayez de saisir de nouvelles valeurs dans width_txt et height_txt pour modifier les dimensions de my_txt.
_height (propriété TextField._height)