0
Text fields
Explorer
,
/t5/animate-discussions/text-fields/td-p/8232188
Mar 30, 2016
Mar 30, 2016
Copy link to clipboard
Copied
I wonder how can I be creating a text field where the user may be clicking in the box and add any number to choose it.
And how can I do to set the variable will only store numeric values using a Number?
Example of text fields which I refer:
Grateful!
TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/animate-discussions/text-fields/m-p/8232189#M157124
Mar 30, 2016
Mar 30, 2016
Copy link to clipboard
Copied
assign each textfield an instance name (in the properties panel). eg, tf_1 and tf_2.
you can use the restrict property of textfields to restrict user input to numbers. eg,
tf_1.restrict='0-9';
and you can use the addF function to return the sum of the textfields:
function addF(tf1:TextField,tf2:TextField):Number{
if(isNaN(Number(tf1.text)) || isNaN(Number(tf2.text)){
return -1;
} else {
return Number(tf1.text)+Number(tf2.text);
}
}
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

