Como siempre los datos de tipo Numbers o numéricos son aquellos que están compuesto por un valor numérico y no literal.
Ejemplo:
-
<span id="gtbmisp_31" style="border: 0pt none; margin: 0pt; padding: 0pt; background: transparent none repeat scroll 0% 0%; font-family: serif; font-style: normal; font-variant: normal; font-weight: bold; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; position: static; text-align: left; text-indent: 0pt; text-transform: none; color: red; text-decoration: underline; cursor: pointer;">var</span> edad:<span id="gtbmisp_32" style="border: 0pt none; margin: 0pt; padding: 0pt; background: transparent none repeat scroll 0% 0%; font-family: serif; font-style: normal; font-variant: normal; font-weight: bold; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; position: static; text-align: left; text-indent: 0pt; text-transform: none; color: red; text-decoration: underline; cursor: pointer;">Number</span> = 30 //correcto
-
<span id="gtbmisp_33" style="border: 0pt none; margin: 0pt; padding: 0pt; background: transparent none repeat scroll 0% 0%; font-family: serif; font-style: normal; font-variant: normal; font-weight: bold; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; position: static; text-align: left; text-indent: 0pt; text-transform: none; color: red; text-decoration: underline; cursor: pointer;">var</span> edad:<span id="gtbmisp_34" style="border: 0pt none; margin: 0pt; padding: 0pt; background: transparent none repeat scroll 0% 0%; font-family: serif; font-style: normal; font-variant: normal; font-weight: bold; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; position: static; text-align: left; text-indent: 0pt; text-transform: none; color: red; text-decoration: underline; cursor: pointer;">Number</span> = "30" //incorrecto
Como podemos observar a simple vista los datos de tipos números carecen de comillas dobles o simples, pueden ser un entero o decimal y siempre el Flash player nos va a devolver como máximo 15 dígitos en pantalla, pero en el podrá operar con mas dígitos.
En el caso de que una variable que debe almacenar un dato de tipo numérico o una operación nos deba devolver un resultado y este no es un numero, el Flash player no dará como resultante NaN (not a number), digamos que el resultado o el tipo de dato no es un numero.
Como todos sabemos con los números no solo podemos representar cantidades sino la posibilidad mas grande es realizar operaciones entre diferentes valores, sean sumas restas a cosas mas complejas como seno y cosenos de un numero. Flash cuenta con todas las herramientas para ello ya que cuenta con una clase nativa para los datos de tipo Number (clases veremos mas adelante).
Es importante recordar algunas cositas básicas para aquellos como yo que hace bastante tiempo nos alejamos de los libros del secundario o nivel medio, así que las reglas que rigen en Flash para las operaciones de suma, resta, multiplicacion y división son las mismas que las tradicionales así que recordemos que los signos + y - separan términos y los () agrupan las operaciones a evaluar.
Ejemplo:
-
<span id="gtbmisp_47" style="border: 0pt none; margin: 0pt; padding: 0pt; background: transparent none repeat scroll 0% 0%; font-family: serif; font-style: normal; font-variant: normal; font-weight: bold; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; position: static; text-align: left; text-indent: 0pt; text-transform: none; color: red; text-decoration: underline; cursor: pointer;">var</span> a:<span id="gtbmisp_48" style="border: 0pt none; margin: 0pt; padding: 0pt; background: transparent none repeat scroll 0% 0%; font-family: serif; font-style: normal; font-variant: normal; font-weight: bold; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; position: static; text-align: left; text-indent: 0pt; text-transform: none; color: red; text-decoration: underline; cursor: pointer;">Number</span> = 56;
-
<span id="gtbmisp_49" style="border: 0pt none; margin: 0pt; padding: 0pt; background: transparent none repeat scroll 0% 0%; font-family: serif; font-style: normal; font-variant: normal; font-weight: bold; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; position: static; text-align: left; text-indent: 0pt; text-transform: none; color: red; text-decoration: underline; cursor: pointer;">var</span> b:<span id="gtbmisp_50" style="border: 0pt none; margin: 0pt; padding: 0pt; background: transparent none repeat scroll 0% 0%; font-family: serif; font-style: normal; font-variant: normal; font-weight: bold; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; position: static; text-align: left; text-indent: 0pt; text-transform: none; color: red; text-decoration: underline; cursor: pointer;">Number</span> = 4;
-
suma = a+b; //el resultado es la suma de ambos números (60)
-
-
<span id="gtbmisp_51" style="border: 0pt none; margin: 0pt; padding: 0pt; background: transparent none repeat scroll 0% 0%; font-family: serif; font-style: normal; font-variant: normal; font-weight: bold; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; position: static; text-align: left; text-indent: 0pt; text-transform: none; color: red; text-decoration: underline; cursor: pointer;">var</span> a:<span id="gtbmisp_52" style="border: 0pt none; margin: 0pt; padding: 0pt; background: transparent none repeat scroll 0% 0%; font-family: serif; font-style: normal; font-variant: normal; font-weight: bold; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; position: static; text-align: left; text-indent: 0pt; text-transform: none; color: red; text-decoration: underline; cursor: pointer;">Number</span> = 56;
-
<span id="gtbmisp_53" style="border: 0pt none; margin: 0pt; padding: 0pt; background: transparent none repeat scroll 0% 0%; font-family: serif; font-style: normal; font-variant: normal; font-weight: bold; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; position: static; text-align: left; text-indent: 0pt; text-transform: none; color: red; text-decoration: underline; cursor: pointer;">var</span> b:<span id="gtbmisp_54" style="border: 0pt none; margin: 0pt; padding: 0pt; background: transparent none repeat scroll 0% 0%; font-family: serif; font-style: normal; font-variant: normal; font-weight: bold; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; position: static; text-align: left; text-indent: 0pt; text-transform: none; color: red; text-decoration: underline; cursor: pointer;">Number</span> = 4;
-
suma = (a+b)/2; //el resultado es la suma de ambos números divididos por 2 (30), como podemos ver agrupamos la suma usando <span id="gtbmisp_55" style="border: 0pt none; margin: 0pt; padding: 0pt; background: transparent none repeat scroll 0% 0%; font-family: serif; font-style: normal; font-variant: normal; font-weight: bold; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; position: static; text-align: left; text-indent: 0pt; text-transform: none; color: green; text-decoration: underline; cursor: pointer;">paréntesis</span> y luego dividimos por 2