Flash AS½Ì³Ì:Ïêϸ½²½âMath¶ÔÏó
Math¶ÔÏó£¬×÷ΪһÃűà³Ì
ÓïÑÔ£¬½øÐÐÊýѧ¼ÆËãÊDZز»¿ÉÉٵġ£ÔÚÊýѧ¼ÆËãÖо³£»áʹÓõ½Êýѧº¯Êý
£¬ÈçÈ¡¾ø¶ÔÖµ¡¢¿ª·½¡¢È¡Õû¡¢ÇóÈý½Çº¯ÊýÖµµÈ£¬»¹ÓÐÒ»ÖÖÖØÒªµÄº¯ÊýÊÇËæ»úº¯Êý¡£ActionScript½«ËùÓÐÕâЩÓëÊýѧÓйصķ½·¨¡¢³£Êý¡¢Èý½Çº¯ÊýÒÔ¼°Ëæ»úÊý¶¼¼¯Öе½Ò»¸ö¶ÔÏóÀïÃæ——Math¶ÔÏó¡£Math¶ÔÏóÊÇActionScriptµÄÒ»¿éÇÃÃÅש£¬Ö»ÓÐÕÆÎÕÁËËü£¬²ÅÄÜÕæÕý¶ÔActionScript¶¯»
±à³Ì×öµ½ÔËÓÃ×ÔÈç¡£
1 Math¶ÔÏóµÄ·½·¨
1.1 Math.abs
Math¶ÔÏóÖм¯ºÏÁËÐí¶à³£ÓÃÊýѧº¯Êý¡£Math.abs¾ÍÊÇÓÃÀ´¼ÆËãÒ»¸öÊýµÄ¾ø¶ÔÖµ£¬¼´Ò»¸öÊýÈ¥µôÕý¸º·ûºÅºóµÄÖµ¡£ÆäÓ÷¨ÈçÏ£º
x=Math.abs(-9);
»ò£º
x=Math.abs(num1-num2);
11.1.2 Math.round
Math.round·½·¨½«Ò»¸ö¸¡µãÊýËÄÉáÎåÈëΪ×î½Ó½üµÄÕûÊý£¬È磺
trace(Math.round(9.4));
trace(Math.round(9.5));
trace(Math.round(-9.4));
trace(Math.round(-9.5));
trace(Math.round(-9.6));
Êä³ö´°¿ÚÖн«ÏÔʾ£º
9¡¢10¡¢-9¡¢-9¡¢-10
11.1.3 Math.ceil¡¢Math.floor
Math.ceil·½·¨È¡±ÈÒ»¸ö¸¡µãÊý´óÇÒ×î½Ó½üµÄÕûÊý£¬Math.floor·½·¨È¡±ÈÒ»¸ö¸¡µãÊýСÇÒ×î½Ó½üµÄÕûÊý¡£
È磺
trace(Math.ceil(9.1));
trace(Math.floor(9.1));
trace(Math.ceil(-9.1));
trace(Math.floor(-9.1));
Êä³ö´°¿ÚÖн«ÏÔʾ£º
10¡¢9¡¢-9¡¢-10
1.4 Math.min¡¢Math.max
Math.min·½·¨È¡Á½¸öÊýÖнÏСµÄÒ»¸öÊý£¬Math.max·½·¨È¡Á½¸öÊýÖнϴóµÄÒ»¸öÊý£¬È磺
trace(Math.min(9,
8));
trace(Math.max(9,
8));
Êä³ö´°¿ÚÖÐÏÔʾ£º
8¡¢9
1.5 Math.pow
Math.pow·½·¨ÓÃÀ´¼ÆËãÒ»¸öÊýµÄ³Ë·½£¬Ëü°üº¬Á½¸ö²ÎÊý£¬µÚ1¸ö²ÎÊýÊǵ×Êý£¨Òª³Ë·½µÄÊý£©£¬µÚ2¸ö²ÎÊýÊÇÃÝ£¨³Ë·½Êý£©¡£Èç¼ÆËã5µÄ3´Î·½£º
trace(Math.pow(5,
3));
Êä³ö´°¿ÚÖÐÏÔʾ£º
125
Math.pow·½·¨Ò²¿ÉÒÔ¼ÆËãÒ»¸öÊýµÄ¿ª·½£¬Èç¼ÆËã125µÄ¿ª3´Î·½£º
trace(Math.pow(125,
1/3));
Êä³ö´°¿ÚÖÐÏÔʾ
5
1.6 Math.sqrt
³ýÁËÓÃMath.pow¼ÆËãÒ»¸öÊýµÄ¿ª·½£¬»¹¿ÉÒÔʹÓÃMath.sqrt¼ÆËãÒ»¸öÊýµÄƽ·½¸ù£¬Èç¼ÆËã64µÄƽ·½¸ù£º
trace(Math.sqrt(64));
Êä³ö´°¿ÚÖÐÏÔʾ
8
ËüµÈͬÓÚ£º
trace(Math.pow(64,
1/2));
2 Math¶ÔÏóµÄ³£Êý
Math¶ÔÏóµÄ³£ÊýÓÐÒÔϼ¸¸ö£º
=
Math.PI£ºÔ²ÖÜÂÊ£¨´óԼΪ3.141593£©¡£
= Math.SQRT1_2£º1/2µÄƽ·½¸ùµÄµ¹Êý£¨´óԼΪ0.707107£©¡£
=
Math.SQRT2£º2µÄƽ·½¸ù£¨´óԼΪ1.414214
Ïà¹ØÎĵµ£º
Ò»¡¢»ù±¾ÔÀí¼°¹ý³Ì
Flashͨ¹ýExternalInterfaceÀàÓëÈÝÆ÷Ó¦ÓóÌÐò½øÐÐͨÐÅ¡£Îª´Ë£¬ExternalInterfaceÀàÌṩÁ½¸ö¾²Ì¬ÊôÐÔºÍÁ½¸ö¾²Ì¬·½·¨¡£
ExternalInterface.call(“º¯ÊýÃû”£¬[²ÎÊý…])·½·¨Ö´ÐÐÈÝÆ÷Ó¦ÓóÌÐòµÄ´úÂ룬¸Ã·½·¨ÖÁÉÙÐèÒªÒ»¸ö×Ö·û´®²ÎÊýÀ´Ö¸¶¨Òªµ÷Óõĺ¯ÊýÃû£¬ÆäËüÈκβÎÊý½«×÷Ϊ²ÎÊý±»´«µÝ¸ø± ......
´Ó½ñÌìÆð,ÎÒÃÇÀ´Ñ§Ï°Ò»Ï Flash Media Server£¬¼ò³ÆFMS£¬´ÓÃû×ÖÉÏÎÒÃÇ¿ÉÒÔ¿´³öÕâÊÇÒ»¸öýÌå·þÎñÆ÷£¬ÆäËü¼òµ¥µãÀí½â¾ÍÊÇÒ»¸ö½»»¥·þÎñÆ÷£¬¶øÇÒ¿ÉÒÔʵÏÖýÌå·½ÃæµÄ½»»¥£¬ÎÒÃÇ¿ÉÒÔÀûÓÃËüÀ´Íê³ÉһЩÍøÂç°æµÄFLASH³ÌÐò£¬±ÈÈçÁÄÌìÊÒ£¬ÍøÂç°æµÄ²»ÊǺܸ´ÔÓµÄÓÎÏ·£¬µÈµÈ¡£
´ó¼Ò¿ÉÒÔµ½ÈçϵØÖ·ÏÂÔØ×îеÄ3.0°æ±¾:
http://w ......
flashÎļþϵͳʵÏÖÔÀí
http://www.dpj.com.cn/ ÍøÖ·
ÕªÒª£ºÔÚÉîÈë·ÖÎöTIΪ¿ª·¢DSPÌṩµÄRTS.LIB(RTS.SRCΪԴȪ´úÂë)µÄ»ù´¡ÉÏ£¬½éÉܶÔ×Ô¶¨ÒåµÄÎļþºÍÉ豸µÄ²Ù×÷·½·¨£»Éè¼ÆÒ»¸ö¼òÒ×µÄFlashÎļþϵͳ£¬¼«
´óµØ·½±ãÁËÓ¦Óñà³Ì¡£
¹Ø¼ü´Ê£ºDSP CC/CCS Flash Îļþϵͳ
1 ¸ÅÊö
ÔÚ¿ª·¢DSPµÄÓ¦ÓóÌÐ ......