µÚÒ»·¶ÎÄÍø - רҵÎÄÕ·¶ÀýÎĵµ×ÊÁÏ·ÖÏíÆ½Ì¨

Flash - ActionScript±à³ÌÖÆ×÷ÎïÀí¿Î¼þʵÀý½Ì³Ì2012

À´Ô´£ºÓû§·ÖÏí ʱ¼ä£º2025/11/29 22:29:38 ±¾ÎÄÓÉloading ·ÖÏí ÏÂÔØÕâÆªÎĵµÊÖ»ú°æ
˵Ã÷£ºÎÄÕÂÄÚÈݽö¹©Ô¤ÀÀ£¬²¿·ÖÄÚÈÝ¿ÉÄܲ»È«£¬ÐèÒªÍêÕûÎĵµ»òÕßÐèÒª¸´ÖÆÄÚÈÝ£¬ÇëÏÂÔØwordºóʹÓá£ÏÂÔØwordÓÐÎÊÌâÇëÌí¼Ó΢ÐźÅ:xxxxxxx»òQQ£ºxxxxxx ´¦Àí£¨¾¡¿ÉÄܸøÄúÌṩÍêÕûÎĵµ£©£¬¸ÐлÄúµÄÖ§³ÖÓëÁ½⡣

Flash ActionScript±à³ÌÖÆ×÷ÎïÀí¿Î¼þʵÀý½Ì³Ì

3¡¢Ð½¨°´Å¥Ôª¼þ£ºballoon_btn£¬Ç°3Ö¡¾ùʹÓÿհ×Ö¡£¬ÔÚµÚËÄÖ¡£¨µã»÷£©ÄÚ£¬ÔÚÖÐÐÄÊ®×Ö´¦»æÖÆÒ»¸ö¿í50ÏóËØ£¬¸ß60ÏóËØµÄÍÖÔ²¡£

4¡¢Ð½¨Ó°Æ¬¼ô¼­Ôª¼þ£ºballoon¡£µÚÒ»²ãÖ¡±êÇ©ÉèΪ£ºbg_color£¬ÔÚÖÐÐÄÊ®×Ö»æÖÆÒ»¸öÌî³äÑÕɫʹÓûÆÉ«£¬Ã»Óб߿ò£¬¿í50ÏóËØ£¬¸ß60ÏóËØµÄÍÖÔ²¡£

5¡¢ÔÚballoonÔª¼þн¨Ò»²ã£¬²ã±êÇ©ÉèΪ£ºcolor¡£½«Ôª¼þballoon_color´Ó¿âÖÐÍÏÖÁÖÐÐÄÊ®×Ö£¬¸ÕºÃ¸²¸Çbg_color²ãµÄÍÖÔ²£¬ÊµÀýÃûÉèΪcolor_mc¡£

6¡¢ÔÚballoonÔª¼þн¨Ò»²ã£¬²ã±êÇ©ÉèΪ£ºbutton¡£½«Ôª¼þballoon_btn´Ó¿âÖÐÍÏÖÁÖÐÐÄÊ®×Ö£¬¸ÕºÃ¸²¸ÇǰÁ½²ãµÄÍÖÔ²£¬ÊµÀýÃûÉèΪballoon_btn¡£

7¡¢ÔÚballoonÔª¼þн¨Ò»²ã£¬²ã±êÇ©ÉèΪ£ºtext¡£ÔÚÖÐÐÄÊ®×Ö´¦½¨Á¢Ò»¸ö¶¯Ì¬Îı¾£¬ÐÞ¸ÄÎı¾¿òµÄ¿í¶ÈÖÁÖ»ÄÜÏÔʾһ¸öÊý×Ö¡£È¡ÏûÊôÐÔÃæ°åÖеġ°¿ÉÑ¡¡±°´Å¥£¬Èçͼ¡£

8¡¢ÔÚballoonÔª¼þн¨Ò»²ã£¬²ã±êÇ©ÉèΪ£ºtrail¡£ÔÚÆøÇòÏ·½Ìí¼ÓÒ»¸ù¶ÌÇúÏߣ¬×÷ÎªÆøÇòµÄÀ­Ïß¡£

9¡¢ÔÚballoonÔª¼þн¨Ò»²ã£¬²ã±êÇ©ÉèΪ£ºaction¡£ÔÚaction²ãµÄµÚÒ»Ö¡ÊäÈëActionScript£º var num:Number = Math.ceil(Math.random()*9); //ÆøÇòÏÔʾ·ÖÊýΪ1-9µÄËæ»úÊý color_mc._alpha = num*10;

//¸ù¾ÝÆøÇò·ÖÊý²»Í¬ÏÔʾ²»Í¬ÑÕÉ« this.onEnterFrame = function() { //ÆøÇòÿ֡Ô˶¯ _y -= 4*(1+_root.score/300); //ÆøÇòÉÏÉý¡£µÃ·ÖÔ½¶à£¬ÉÏÉýËÙ¶ÈÔ½¿ì if (_y<-60) { //ÆøÇòÉÏÉýÖÁÆÁÄ»ÉÏÑØ _y = 440; _x = 25+Math.random()*500; //ÖØÉèλÖà _root.life--; //¼õÉÙÉúÃüÖµ if (_root.life<=0) { _root.gotoAndStop(2); } } _x += 6*(Math.random()-0.5)*(1+_root.score/300); //ÆøÇò×óÓһζ¯¡£µÃ·ÖÔ½¶à£¬»Î¶¯·ù¶ÈÔ½´ó };

µÚ 41 Ò³ ¹² 79 Ò³

Flash ActionScript±à³ÌÖÆ×÷ÎïÀí¿Î¼þʵÀý½Ì³Ì

balloon_btn.onPress = function() { //µã»÷°´Å¥ if (_root.life>0) { _root.score += num; num = Math.ceil(Math.random()*9); color_mc._alpha = num*10; _y = 440; _x = 25+Math.random()*500; } };

10¡¢»Øµ½Ö÷³¡¾°£¬½«Í¼²ã1±êÇ©¸ÄΪ£ºmain¡£·Ö±ð½¨Á¢Á½¸öÆÕͨÎı¾¿ò£¬·Ö±ðдÈë¡°µÃ·Ö£º¡±¡¢¡°ÉúÃü£º¡±¡£½¨Á¢Á½¸ö¶¯Ì¬Îı¾¿ò£¬±äÁ¿´¦·Ö±ðÌîÈë¡°score¡±ºÍ¡°life¡±¡£

11¡¢½«balloonÔª¼þÍÏÈëÖ÷³¡¾°£¬ÊµÀýÃûÉèΪ£ºballoon_mc¡£

12¡¢Ëø¶¨main²ã£¬Ð½¨Ò»²ã£¬²ã±êÇ©ÉèΪ£ºaction¡£action²ãµÚһ֡дÈëActionScipt£º var score:Number = 0;

//µÃ·Ö£¬»÷ÖÐÆøÇò»ñµÃÆøÇòËùÏÔʾµÄ·ÖÊý var life:Number = 20;

//ÉúÃü£¬Â©µô1¸öÆøÇòÉúÃü¼õÉÙ1 var i;

for (i=1; i<10; i++) { //¸´ÖÆÆøÇò duplicateMovieClip(\ this[\ this[\}

balloon_mc._visible = 0; //Òþ²ØÔ­Ä£°åÆøÇò stop();

13¡¢Ð½¨Ò»²ã£¬²ã±êÇ©ÉèΪ£ºshow¡£show²ãµÚÒ»Ö¡ÉèΪ¿Õ°×¹Ø¼üÖ¡£¬µÚ¶þ֡н¨Ò»ÆÕͨÎı¾¿ò£¬Ð´È룺Äúʧ°ÜÁË¡£

14¡¢±£´æ£¬·¢²¼¡£

¡¾Àý7-5˵Ã÷¡¿

ÆøÇò³õʼλÖÃÎªËæ»ú·Ö²¼£¬»ºÂýÉÏÉý£¬Í¬Ê±×óÓһζ¯¡£Êó±êµã»÷ÆøÇò¼´½«ÆøÇò»÷Ë飬¿ÉµÃÆøÇòÉÏÏÔʾ·ÝÊý¡£³õÊÔÉúÃüֵΪ20£¬Ã»ÓÐÒ»¸öÆøÇòÉýµ½ÆÁÄ»¶¥¶Ë£¬ÉúÃüÖµ¼õ1¡£ÆøÇòÉÏÉýËٶȺͻζ¯·ù¶È»áËæ×ŵ÷ÖÔö¼ÓÖð½¥¼Ó¿ì¡£ÆøÇòÏÔʾ·ÖÊýÔ½¸ß£¬ÑÕɫԽ½Ó½üºìÉ«¡£

³ÌÐòÖÐÒÑÓÐ×¢ÊÍ£¬ÇëͬѧÃÇÈÏÕæÀí½â¡¢Ë¼¿¼³ÌÐò£¬¿´¿´ÎªÁËʵÏÖÿһ¸ö¹¦ÄÜÉ趨£¬Ê¾ÀýÖж¼ÊÇÔõôÉè¼ÆµÄ¡£

µÚ 42 Ò³ ¹² 79 Ò³

Flash ActionScript±à³ÌÖÆ×÷ÎïÀí¿Î¼þʵÀý½Ì³Ì

¡¾Àý7-6£ºÐ¡ÇòÅö±Ú·´µ¯¡¿

1¡¢Ð½¨FlashÎĵµ£¬´óСÉèΪ550*400¡£ 2¡¢Ð½¨Ó°Æ¬¼ô¼­Ôª¼þball£¬ÔÚÖÐÐÄ»æÖÆ´óСΪ40µÄÇò¡£ÍÏÈëÖ÷³¡¾°£¬ÊµÀýÃû³ÆÉèΪball_mc¡£

3¡¢ÔÚ³¡¾°ÖÐÐÄ»æÖÆÒ»¸ö530*380µÄ±ß¿ò£¬¾àÀë±ßÔµ10ÏóËØ¡£

4¡¢Ð½¨action²ã£¬ÔÚaction²ãµÚһ֡дÈëActionScript£º ball_mc._x = 10+Math.random()*510; ball_mc._y = 10+Math.random()*360; var v:Number = 15;

var angle:Number = Math.random()*Math.PI; var vx:Number = v*Math.cos(angle); var vy:Number = v*Math.sin(angle);

5¡¢ÔÚaction²ãµÚ¶þ֡дÈëActionScript£º ball_mc._x += vx; if (ball_mc._x>=520) { ball_mc._x = 520-(ball_mc._x-520); vx *= -1; }

if (ball_mc._x<=30) { ball_mc._x = 30+(30-ball_mc._x); vx *= -1; }

ball_mc._y += vy; if (ball_mc._y>=370) { ball_mc._y = 370-(ball_mc._y-370); vy *= -1; }

if (ball_mc._y<=30) { ball_mc._y = 30+(30-ball_mc._y); vy *= -1; }

6¡¢ÔÚaction²ãµÚÈý֡дÈëActionScript£º gotoAndPlay(2); 7¡¢±£´æ£¬·¢²¼¡£

¡¾Àý7-6˵Ã÷¡¿

±¾ÀýÖÐʹСÇòËÙ¶ÈËæ»úµÄÓï¾ä£¬Ê¹ÓÃÁËÈ·¶¨ËÙ¶È£¬Ëæ»ú·½ÏòµÄ×ö·¨£¬Ã»ÓÐʹÓÃÀàËÆ var vx:Number = Math.random()*20-10; var vy:Number = Math.random()*20-10;

µÄ·½·¨ÊÇÒòΪÕâÑùÓпÉÄÜËæ»ú³öˮƽºÍÊúÖ±·½ÏòËٶȶ¼ºÜСµÄÖµ£¬Ê¹¶¯»­Ð§¹û²»Ã÷ÏÔ¡£

µÚ 43 Ò³ ¹² 79 Ò³

Flash ActionScript±à³ÌÖÆ×÷ÎïÀí¿Î¼þʵÀý½Ì³Ì

µÚÆß¿Î Á÷³Ì¿ØÖÆ¡ª¡ªÑ­»·

ÔÚÐí¶à±à³ÌÎÊÌâÖж¼ÐèҪʹÓÃÑ­»·£¬ÀýÈçÔÚÒ»Ö¡ÄÚ¸´ÖÆÓ°Æ¬¼ô¼­»æÖÆÇúÏß¡¢ÉèÖôóÁ¿¹æÔòӰƬ¼ô¼­µÄÊôÐԵȣ¬Ç°ÃæÎÒÃǾ­³£Ê¹ÓõÄ3Ö¡¶¯»­Êµ¼ÊÉϾÍÊÇÀûÓÃflashµÄʱ¼äÖáÌø×ªÖ¸ÁîʵÏÖµÄÑ­»·µÄÒ»ÖÖÐÎʽ¡£ActionScriptÖеÄÑ­»·Ö÷ÒªÓÐ4ÖÖ£ºfor¡¢while¡¢do¡­while¡¢for¡­in¡£´¦ÓÚ¸öÈËµÄÆ«ºÃ£¬ÎÒ¸üϲ»¶Ê¹ÓÃforÓï¾ä¡£ÎÒÃÇÏÂÃæÒ»´Î½øÐÐһϽéÉÜ¡£

forÑ­»·Óï¾äµÄÒ»°ãÐÎʽΪ£º

for(³õÊÔ±í´ïʽ;Ìõ¼þ±í´ïʽ;µÝÔö±í´ïʽ){ ³ÌÐò

}

ϰ¹ßÉÏforÑ­»·Ê¹ÓÃi¡¢j¡¢k×÷Ϊѭ»·µÄ¼ÆËã±äÁ¿£¬³õÊÔ±í´ïʽºÍÌõ¼þ±í´ïʽһ°ãÊÇÑ­»·±äÁ¿µÄÆðʼֵ£¬ÔöÁ¿±í´ïʽʹÓÃ++»òÕß--£¨ÕâÁ½ÖÖÔËËãÔÚ¼ÆËã»úÖÐÖ´ÐÐЧÂÊ×î¸ß£©¡£ ¡¾Àý7-1£ºµÈ²îÊýÁÐÇóºÍÔËËã¡¿ 1¡¢Ð½¨flashÎļþ¡£

2¡¢ÔÚµÚÒ»Ö¡ÄÚдÈëÈçÏÂActionScript£º var i:Number;

var sum:Number = 0; for (i=1; i<=100; i++) { sum += i; }

trace(sum);

3¡¢±£´æ£¬Ö±½ÓʹÓá°¿ØÖÆ¡±²Ëµ¥¡ª¡ª¡°²âÊÔӰƬ¡±·¢²¼Ô¤ÀÀ¡£ ¡¾Àý7-1˵Ã÷¡¿

±¾ÀýÊÇforÑ­»·µÄ¼òµ¥Ó¦Óã¬trace()º¯Êý¿ÉÔÚ²âÊÔӰƬʱ½«±äÁ¿¡¢ÐÅÏ¢µÈÏÔʾÔÚoutputÃæ°åÄÚ£¬ÊdzÌÐò½øÐе÷ÊÔʱµÄÁ¼ºÃ¹¤¾ß£¬¿ÉÒÔÏÔʾ·ÖÖ§Á÷³Ì¡¢ÏÔʾ±äÁ¿ÖµµÈ??

¡¾Àý7-2£º»æÖÆÇúÏß·½³Ì¡¿

1¡¢ÔÚÀý5-3»ù´¡ÉϼÌÐø½øÐÐÐ޸ġ£

2¡¢½«action²ãµÚÒ»Ö¡ActionScriptÐÞ¸ÄΪ£º var vx:Number = 5; var vy:Number = 10; var a:Number = 0.2; var i:Number = 0;

for (i=1; i<=550; i++) { duplicateMovieClip(\ this[\ this[\}

3¡¢É¾³ýÔª¼þball_mc¡£É¾³ý¸÷²ãµÚ¶þ¡¢ÈýÖ¡¡£Áí´æÎªÀý7-2£¬·¢²¼¡£

µÚ 44 Ò³ ¹² 79 Ò³

ËÑË÷¸ü¶à¹ØÓÚ£º Flash - ActionScript±à³ÌÖÆ×÷ÎïÀí¿Î¼þʵÀý µÄÎĵµ
Flash - ActionScript±à³ÌÖÆ×÷ÎïÀí¿Î¼þʵÀý½Ì³Ì2012.doc ½«±¾ÎĵÄWordÎĵµÏÂÔØµ½µçÄÔ£¬·½±ã¸´ÖÆ¡¢±à¼­¡¢ÊղغʹòÓ¡
±¾ÎÄÁ´½Ó£ºhttps://www.diyifanwen.net/c7ztk821b824bptb10m40_11.html£¨×ªÔØÇë×¢Ã÷ÎÄÕÂÀ´Ô´£©

Ïà¹ØÍÆ¼ö£º

ÈÈÃÅÍÆ¼ö
Copyright © 2012-2023 µÚÒ»·¶ÎÄÍø °æÈ¨ËùÓÐ ÃâÔðÉùÃ÷ | ÁªÏµÎÒÃÇ
ÉùÃ÷ :±¾ÍøÕ¾×ðÖØ²¢±£»¤ÖªÊ¶²úȨ£¬¸ù¾Ý¡¶ÐÅÏ¢ÍøÂç´«²¥È¨±£»¤ÌõÀý¡·£¬Èç¹ûÎÒÃÇ×ªÔØµÄ×÷Æ·ÇÖ·¸ÁËÄúµÄȨÀû,ÇëÔÚÒ»¸öÔÂÄÚ֪ͨÎÒÃÇ£¬ÎÒÃǻἰʱɾ³ý¡£
¿Í·þQQ£ºxxxxxx ÓÊÏ䣺xxxxxx@qq.com
ÓåICP±¸2023013149ºÅ
Top