Flash¿ÉÒÔͨ¹ýÖ¡¡¢°´Å¤¡¢Ó°Æ¬¼ô¼À´µ÷ÓÃÍⲿÎļþ¡£µ÷ÓõÄÍⲿÎļþ°üÀ¨£ºÍⲿÎı¾Îļþ¡¢Íⲿ³ÌÐòÎļþ¡¢Íⲿ*.swfÎļþ¡¢ÍⲿͼƬÎļþ¡¢ÍⲿÒôÀÖÎļþ¡¢Íⲿ½Å±¾Îļþ .ÏÖ×ܽáÈçÏÂ
Flash¿ÉÒÔͨ¹ýÖ¡¡¢°´Å¤¡¢Ó°Æ¬¼ô¼À´µ÷ÓÃÍⲿÎļþ¡£µ÷ÓõÄÍⲿÎļþ°üÀ¨£ºÍⲿÎı¾Îļþ¡¢Íⲿ³ÌÐòÎļþ¡¢Íⲿ*.swfÎļþ¡¢ÍⲿͼƬÎļþ¡¢ÍⲿÒôÀÖÎļþ¡¢Íⲿ½Å±¾Îļþ .ÏÖ×ܽáÈçÏ£º
¡¾loadMovieNum()º¯Êý¡¿
[Ó÷¨]£ºloadMovieNum(”url”,level [, variables])
[¹¦ÄÜ]: º¯Êý£»ÔÚ²¥·ÅÔÀ´¼ÓÔØµÄ SWF ÎļþµÄͬʱ½« SWF Îļþ»ò JPEG Îļþ¼ÓÔص½ Flash Player ÖеÄij¸ö¼¶±ð¡£
[²ÎÊý]£ºÊ×ÏÈÎÒÃÇ¿ÉÒÔ¿´µ½¸Ãº¯ÊýÓÐ3¸ö²ÎÊý£ºurl¡¢target¡¢variables¡£ÆäÖУ¬×îºóÒ»¸ö²ÎÊý variables ÊÇÒ»¸ö¿ÉÑ¡²ÎÊý¡£
1.²ÎÊýurl£ºÒª¼ÓÔØµÄ SWF Îļþ»ò JPEG ÎļþµÄ¾ø¶Ô»òÏà¶Ô URL£¨Â·¾¶£©¡£
¸Ãº¯ÊýµÄ´Ë²ÎÊýºÍÉÏÃæloadMovieÖеĴ˲ÎÊýÓ÷¨ÍêÈ«Ò»Ö£¬ÕâÀï²»ÔÙ×÷½âÊÍ¡£
2.²ÎÊýlevel£ºÒ»¸öÕûÊý£¬Ö¸¶¨ SWF Îļþ½«¼ÓÔص½Flash PlayerÖеÄÄĸö¼¶±ð¡£¼ÓÔصÄʱºò£¬¿ÉÒÔÕâÑùÀ´Ð´£º
loadMovieNum(”01.swf”, 1);
loadMovieNum(”02.swf”, 2);
loadMovieNum(”03.swf”, 3);
¡¾loadMovieNum¼ÓÔغóµÄ¿ØÖÆ¡¿
¿ÉÒÔÕâÑùʹÓãº
_level1._x=10 ;
_level2.aa._alpha=50 ;
_level3.aa.bb._width=110;
_level4.mysound.stop();// ¼ÓÔص½¼¶±ðΪ4µÄ¶ÔÏóMC:mysoundÍ£Ö¹£¨²¥·ÅÒôÀÖ£©
ÐèҪעÒâµÄµÄÊÇ£¬Ã¿Ò»¸ö¼¶±ðÖ»ÄÜͬʱ´æÔÚÒ»¸ö SWF »ò JPEG Îļþ¡£Èç¹ûÁ½¸ö SWF »ò JPEG ÎļþµÄ¼¶±ðÏàͬ£¬ÄÇôºóÕß½«Ìæ»»µôÇ°Õß¡£¼¶±ð²»Í¬µÄ_level£¬¼¶±ð´óµÄ½«¸²¸Çµô¼¶±ðСµÄ£¬¼´£ºÊý×Ö´óµÄ½«´¦ÓÚÊý×ÖСµÄÖ®ÉÏ(ÈçÉÏÀý£º03.swf´¦ÔÚ02.swfºÍ01.swfÉÏ·½£¬02.swf´¦ÔÚ01.swfÉÏ·½) ¡£
×¢Ò⣺Èç¹û½« SWF Îļþ¼ÓÔص½¼¶±ð 0£¬Ôò Flash Player ÖеÄÿ¸ö¼¶±ð¾ù±»Ð¶ÔØ£¬²¢ÇÒ¼¶±ð 0 ½«Ì滻Ϊ¸ÃÐÂÎļþ¡£´¦ÓÚ¼¶±ð 0 µÄ SWF ÎļþΪËùÓÐÆäËü¼ÓÔØµÄ SWF ÎļþÉèÖÃ֡Ƶ¡¢±³¾°É«ºÍÖ¡´óС¡£È磺
loadMovieNum(”00.swf”, 0); //ÒÔϾù²»ÏÔʾ£¬ÕâÑùÖ»ÓÐÒ»¸ö00.swf
loadMovieNum(”01.swf”, 1);
loadMovieNum(”02.swf”, 2);
loadMovieNum(”03.swf”, 3);
3.²ÎÊývariables£º¿ÉÑ¡²ÎÊý£¬Ö¸¶¨·¢ËͱäÁ¿ËùʹÓÃµÄ HTTP ·½·¨¡£¸Ã²ÎÊý±ØÐëÊÇ×Ö·û´® GET »ò POST¡£Èç¹ûûÓÐÒª·¢Ë͵ıäÁ¿£¬ÔòÊ¡ÂԴ˲ÎÊý¡£GET ·½·¨½«±äÁ¿×·¼Óµ½ URL µÄĩ⣬ËüÓÃÓÚ·¢ËÍÉÙÁ¿µÄ±äÁ¿¡£POST ·½·¨ÔÚµ¥¶ÀµÄ HTTP ±êÍ·Öз¢ËͱäÁ¿£¬ËüÓÃÓÚ·¢ËÍ´óÁ¿µÄ±äÁ¿¡£
¡¾loadMovieNum()µÄжÔØ¡¿
ʹÓà unloadMovieNum() ¿Éɾ³ýÓà loadMovieNum() ¼ÓÔØµÄ SWF Îļþ»òͼÏñ¡£
Ó÷¨: unloadMovieNum(level)
²ÎÊý: level Ëù¼ÓÔØӰƬµÄ¼¶±ð (_levelN)¡£
È磺on(release){
¡¡¡¡¡¡unloadMovieNum (1200);//ÈçÏÂ:unloadMovieNum (_level1200);²»ÄÜжÔØ
¡¡¡¡¡¡loadMovieNum (”sje.swf”,1200)
¡¡¡¡¡¡}
¡¾loadMovieNum()µÄ¶¨Î»¡¿
´ÓÇ°ÃæÎÒÃÇÒѾ֪µÀÁË£¬º¯ÊýloadMovieNumÊǽ« SWF »ò JPEG Îļþ¼ÓÔص½_level£¨¼¶±ð£©µÄ¡£²¢ÇÒÊÇÓÃ_level1._x¡¢_level2._x¡¢_level1.aa._xÖ®ÀàµÄÀ´¶¨Î»µÄ¡£±ÈÈçÎÒÃÇÒª½«02.swf¼ÓÔص½Ö÷³¡¾°×ø±êϵµÄ(50,100)ÖУ¬´úÂëÈçÏ£º
loadMovieNum ( “02.swf” , 1 ); //¼«ÓпÉÄܲ»ÄÜÈçÔ¸¶¨Î»
_level1. _x = 50 ;
_level1. _y = 100 ;
µ«ÊÇÔÚ²âÊÔµÄʱºò´ó¼Ò»á·¢ÏÖ¼ÓÔؽøÀ´µÄ02.swf²¢Ã»ÓÐÈçÎÒÃÇÔ¤ÆÚµÄÄÇÑù³öÏÖÔÚÖ÷³¡¾°×ø±êϵµÄ(50,100)λÖã¬ÕâÊÇΪʲôÄØ£¿
ÔÀ´£¬ÔÚûÓÐʹÓÃloadMovieNumÒÔÇ°£¬ËùÓеÄͼÐΡ¢MCµÈµÈ¶¼ÊÇ´¦ÓÚ_level0ÀïµÄ£¬ÎÒÃÇͨ³£Ê¹ÓõÄ_rootÆäʵ¾ÍÊÇ_level0¡£Äã¿ÉÒÔ×÷¸ö²âÊÔ£ºtrace(_root==_level0)£¬Äã»á·¢ÏÖ·µ»ØÖµÊÇ“true”¡£
ÄÇô£¬ÎÒÃÇÓÃloadMovieNum¼ÓÔØ SWF »ò JPEG ÎļþµÄʱºò£¬³ÌÐò¾ÍÒª¶ÔÄãÖ¸¶¨µÄ_level½øÐд´½¨£¬ËæºóÔÙ½ô½Ó×ÅÔØÈë SWF »ò JPEG Îļþ¡£Èç¹ûÏñ¸Õ²Å´úÂëÖÐдµÄÄÇÑù£¬²»ÅжÏ_levelÊÇ·ñ´æÔÚ¶øµ÷ÓÃÆäÊôÐÔ£¬ÊƱØÎÞ¹¦¶ø·´¡£
½â¾öµÄ·½·¨Ò²ºÜ¼òµ¥£¬¾ÍÊÇÓÃÒ»¸öÑ»·À´ÅжÏÖ¸¶¨µÄ_levelÊÇ·ñ´æÔÚ¡£Ò»µ©_level²úÉú£¬ÄÇôËüµÄÖÖÖÖÊôÐÔ×ÔÈ»¿ÉÒÔµ÷ÓÃÁË¡£´úÂëÈçÏ£º
loadMovieNum ( “02.swf” , 1 ); //ÈçÔ¸¶¨Î»
onEnterFrame = function () {
if ( _level1 ) {
with ( _level1 ) {
_x = 50 ;
_y = 100 ;
}
delete onEnterFrame ;
}
};
»òÕߣº(ÉÏÃæµÄ½ÏºÃЩ)
loadMovieNum ( “02.swf” , 1 );
function go () {
if ( _level1 ) {
with ( _level1 ) {
_x = 50 ;
_y = 100 ;
}
clearInterval ( fps ); //Çå³ý¶Ô setInterval() µÄµ÷ÓÃ
}
}
fps = setInterval ( go,100 );//ÿ¸ôÒ»¶¨µÄʱ¼ä£¬¾Íµ÷Óú¯Êý¡¢·½·¨»ò¶ÔÏó
ÔÙ»òÕß´ó¼Ò¿ÉÒÔʹÓÃMacromedia Flash MX 2004ÖеÄMovieClipLoaderÀàÀ´ÅжϼÓÔØ״̬¡£
¡¾×¢Òâ¡¿Éî¶ÈdepthÖµÔ½´ó£¬Æä¼ÓÔصÄÄÚÈÝÔ½Íùºó£¬¼´Ô½ÔÚϲ㣬´¦ÓÚÏ·½£¬±»Õڸǣ»ÕâÓ뼶±ð±êʶ·û_levelN Ïà·´£¬ÔÚ_levelN ÖÐ N ÖµÔ½´ó£¬Æä¼ÓÔصÄÄÚÈÝÔ½ÍùÇ°£¬¼´Ô½ÔÚÉϲ㣬´¦ÓÚÉÏ·½¡£
¡¾loadMovieNum()±£»¤ÄãµÄ×÷Æ·——ʹÓò»Í¬µÄÀ©Õ¹Ãû¡¿
µ«ÒªÇ¿µôµÄÒ»µãµÄÊÇ£º¼ÓÔØӰƬµÄÀ©Õ¹Ãû²»Ò»¶¨ÒªÒÔ .swf ÃüÃû£¡ËäÈ»¼ÓÔصÄӰƬҲÔÚIEµÄÁÙʱÎļþ¼ÐÖУ¬µ«ÒÑÊÇ×Ô¶¨ÒåµÄÎļþ¸ñʽÁË£¬ÕâÑù¿ÉÒÔÆðµ½±£»¤×÷Óã¡
ÀýÈ磺
loadMovieNum(”feng.exe”,0);//¼ÓÔØfeng.swf ½«À©Õ¹Ãû¸ÄΪ—> feng.exe¼ÓÔØ
/*
loadMovieNum(”feng.txt”,0); //¼ÓÔØfeng.swf ½«À©Õ¹Ãû¸ÄΪ—> feng.txt ¼ÓÔØ
loadMovieNum(”feng.doc”,0); //¼ÓÔØfeng.swf ½«À©Õ¹Ãû¸ÄΪ—> feng.doc ¼ÓÔØ
loadMovieNum(”feng.abcde”,0); //¼ÓÔØfeng.swf½«À©Õ¹Ãû¸ÄΪ —> feng.abcde ¼ÓÔØ
loadMovieNum(”feng”,0); //¼ÓÔØfeng.swf ½«À©Õ¹Ãûɾ³ý—> feng ¼ÓÔØ
*/
http://hi.baidu.com/liforget/blog/category/As2