ActionScript 3 ActionScript 3.0算术运算符

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 ActionScript 3.0算术运算符相关的知识,希望对你有一定的参考价值。

/* Each trace function demonstrates the type 
   of Arithmetic operators in Flash.
   Commented out trace() functions demonstrate
   an easier to read example while the verbose
   versions represent cleaner formatting in 
   the console.*/
			
   //Addition
   trace("The sum of 15 + 6 is: " + (15 + 6)); 
   //trace(15 + 6);
   trace("\n");
			
   //Subtraction
   trace("The difference of 15 and 6 is: " + (15 - 6) );
   //trace(15 - 6);
   trace("\n");
			
   //Multiplication
   trace("The product of 15 and 6 is: " + (15 * 6));
   //trace(15 * 6);
   trace("\n");
			
   //Division
   trace("The quotient of 15 and 6 is: " + (15 / 6));
   //trace(15 / 6);
   trace("\n");
			
   //Modulo
   trace("The modulus (remainder) of 15 and 6 is: " + (15 % 6));
   //trace(15 % 6);
   trace("\n");

   //Order of Operations Example 1
   trace("Parentheticals take precedence in Arithmetic!");
   trace("(4 * 2) + 6 = " + ((4 * 2) + 6));
   //trace((4 * 2) + 6);
   trace("\n");
			
   //Order of Operations Example 2
   trace("(10 + 6) * 3 = " + ((10 + 6) * 3));
   trace("\n");
			
   //String Concatenation Example
   var concatSentence:String = "This is an example of " + "string concatenation.";
   trace(concatSentence);

以上是关于ActionScript 3 ActionScript 3.0算术运算符的主要内容,如果未能解决你的问题,请参考以下文章

在 JavaScript 和 ActionScript 之间共享数组引用

MXML 和用于移动设备的 ActionScript 之间的真正区别是啥?

ActionScript 3 使用ActionScript 3暂停框架

ActionScript 3 ActionScript 3延迟功能

ActionScript 3 ActionScript 3 SliceBitmap类

ActionScript 3 ActionScript 3中的XML循环