½Ò ¸¹   /   ¯Z §O 40184438 / E  ¿ï­× 3 ¾Ç¤À  
¬ì¥Ø¤¤¤å¦WºÙ 2D ¤¬°Ê³]­p  
¬ì¥Ø­^¤å¦WºÙ 2D Interactive Programming 
¨C¶g±Â½Ò®É¼Æ 3 ¤p®É ¿ï­×  
¤W½Ò¦aÂI: ºî421   ¤W½Ò®É¶¡:  301, 302, 303 (¬P´Á¤T¤W¤È08:20-11:10)
  ½Ðª`·N: ¾Ç®Õ³W©w¥²¶·ÂI¦W! 
     8:29¤§«á¤~¨ì°OÃm½Ò1¤p®É; 9:29¤§«á¤~¨ì°OÃm½Ò2¤p®É; 10:29¤§«á¤~¨ì°OÃm½Ò3¤p®É
¥ô ½Ò ¦Ñ ®v ½²¤å¯à tsaiwn@ydu.edu.tw

* ¥»½Òµ{µû¤À­ì«h
* ¦p¦óµ½¥Î µ{¦¡½X¤ù¬q(Code Snippets)
  * ¦p¦ó¦Û¤v¼W¥[/½s¼gµ{¦¡½X¤ù¬q(Code Snippets)
    «Øij¥ý§ì¦^³o godSnippets.xml ¨Ã±q§Aªº°Ê§@­±ªO¶×¤J³oµ{¦¡½X¤ù¬q(·Æ¹««ö¥kÁä¥t¦s·sÀÉ) 

* ¦p¦óµ½¥Î  µ{¦¡½X´£¥Ü(Code Hint) 

  ? µ{¦¡½X´£¥Ü«ö¤F¨S®Ä¤£¥X²{«ç»ò¿ì?

* ¦p¦ó¨Ï¥Î ActionScript ¤º«Øªº½d¨Ò(Adobe Help)

* ¦p¦ó¦Û»s«ö¶s? * ©ì©Ôª«¥ó©ñ±¼«á¦p¦óª¾¹D©ñ¦bÔ£ªF¦è¤W? * ¸I¼²°»´ú hitTestObject(ª«¥ó) »P hitTestPointer(X®y¼Ð, Y®y¼Ð) * µ{¦¡³]­p¤Jªù:½Ð¬Ý¬Ý"¶}©l¤W½Ò"¥ªÃ䪺"µ{¦¡³]­p¶W²³æ"(¶}·sµ¡) ©Î¬OÂI³o¸Ì´«±¼¦¹­¶¬Ýµ{¦¡³]­p¶W²³æ"(·|´«±¼¦¹­¶; «ö¥ª¤W¨¤¥i¦^¨ì¦¹­¶) * ³s¹L¥h¬ÝÃö©óÅܼƩR¦WºD¨Ò»P¹êÅé¦WºÙ©R¦W«Øij(·|´«±¼¦¹­¶; «ö¥ª¤W¨¤¥i¦^¨ì¦¹­¶) ¥u·Q¬Ý¬Ý¹êÅé¦WºÙµ²§À(suffix)©R¦W«Øij(·|´«±¼¦¹­¶; «ö¥ª¤W¨¤¥i¦^¨ì¦¹­¶) ¬Æ»ò¬O¹êÅé¦WºÙ(Instance name)?(·|´«±¼¦¹­¶; «ö¥ª¤W¨¤¥i¦^¨ì¦¹­¶) * Javaµ{¦¡¼¶¼g­·®æ(style)»PºD¨Ò(coding convention)(¶}·sµ¡) * °ò¥»½m²ß¥Ø¼Ð»P­n¥Î¨ìªº¸ê·½(Symbols.fla) * ª`·N¾Ç®Õ³W©w­nÂI¦W°OÃm½Ò

µû¤À­ì«h:  (Á`¤À 100 ¤À¥Ñ¥H¤U¤À¶µ¥[Á`)  
   ¤W½Ò¥X®u   20% ~ 35%
   ¥­®É§@·~   20% ~ 35%
   ´Á¤¤¦Ò(²Ä¤E¶g)   20% ~ 35%
   ´Á¥½¦Ò(²Ä¤Q¤K¶g) 25% ~ 35% 
   ** Flash ÃÒ·Ó    ¥t¥~¥[¾Ç´ÁÁ`¤À 15¤À(µn¤Jcertiport.com ¨qµ¹§Ú¬Ý§Y¥i)
¦U¶µ±Ä¼u©Ê­pºâ¬O¥H¹ï¦P¾Ç¦³§Qªººâªk¬°­ì«h :-) 
   ¨Ò¦p, ¨C¦¸³£¦³¨Ó»{¯u¤W½Ò, ¥­®É§@·~¦³°µ,
       ¥B¦Ò¸Õ³£¦³°Ñ¥[, «h§Y¨Ï¦Ò¤£¦n¦Ü¤Ö¤]·|¤Î®æ ƒº:-)
   ¤S¦p, ¯uªº¦³¾Ç·|, ¦Ò¸Õ¦¨ÁZ¤£¿ù, 
       «h³o®É¥X®u²v©Ò¦û¤À¼Æ¤ñ¨Ò´N¤ñ¸û§C 
²³æªº»¡, ¾Ç±oºC©Î¦¨ÁZ¤£¦nªº¦P¾Ç´N¾¨¶q¤£­n¯Ê½Ò!!!



 ­nµ½¥Î  Code Hint(µ{¦¡½X´£¥Ü) »P  Code Snippets(µ{¦¡½X¤ù¬q) 


¦p¦ó¨Ï¥ÎCode Snippets(µ{¦¡½X¤ù¬q)¦Û°Ê¥Í¥Xµ{¦¡½X©O? (1)¥ýÂI¤@¤U¦³«ö¶s©Î¨ä¥L¥i±µ¦¬¨Æ¥óªº¹Ï¼h¼v®æ (2)ºV F9 ©Î¬O¥Î ÂI¿ï"µøµ¡" ¸Ì­±ªº "°Ê§@" §âµ{¦¡½X½s¿èµ¡¥s¥X¨Ó (3)¦b­n¦Û°Ê³B²zªº«ö¶s¤W»´»´ÂI¤@¤U ¦¹®É¥i§Q¥ÎÄݩʵøµ¡§â¥¦ªº¹êÅé¦WºÙ©R­Ó³ßÅwªº¦W, ¤]¥i¥H¤£­n©R¦W, Åý¹q¸£¦Û°Ê©R¦W! (4)¦bµ{¦¡½X½s¿èµ¡ªº "µ{¦¡½X¤ù¬q"(Code Snippets)ÂI¤@¤U, ·|¼u¥X¤pµ¡ (5)¦b¼u¥Xªº"µ{¦¡½X¤ù¬q"¿ï¾Üµ¡¤¤¿ï¨ì§A­nªº¨Æ¥ó³B²z¶µ¥Ø, ³sÂI¨â¤U°Ú´N·|¦Û°Ê¥Í¥Xµ{¦¡½X! (6)ª`·N, ¦pªG¦¹®É³Ì¤W­±¹Ï¼h¤£¬O¥¦¦Û¤v¥Íªº Actions ¹Ï¼h, ªü´N·|¥ß¨è¦Û°Ê¥[¤FActions ¹Ï¼h! ±µ¤U¨Ó, ÁÙ­n¨ìµ{¦¡½X½s¿èµ¡¤º, ¥´¤@ÂIÂI§A§Æ±æ¹q¸£°µªº¨Æ! ²¦³º¹q¸£¤S¤£¬O§A¨{¤ºµîÂÎ, ¤£ª¾¹D§A¨ì©³­n·F¬Æ»ò:-)
³o®É´N­n¦n¦n§Q¥Î µ{¦¡½X´£¥Ü(Code Hint)Åo! ·íµM§AÁÙ¬O±o¥ý¥´¤J«e­±´X­Ó¦r¥À! ³Ì²³æ´N¬O¥ý¥´¤J goto ±µµÛ¥hÂI«ö ¦³­Ó¥ª¬A¸¹³sµÛ»¡©ú¹Ï¥Üªº "Åã¥Üµ{¦¡½X´£¥Ü" µM«á·|¬Ý¨ì©Ò¦³ goto ¶}ÀY¥i¥H¥Îªº»y¥y, ¨ä¹ê¤]¥u¦³ gotoAndStop( ©M gotoAndPlay( ¨â¥y¤l¥i¿ï°Õ ! ¦b§Æ±æ¿ïªº¶µ¥Ø¤W·Æ¹«³sºV¨â¤U§Y¥i !

¬Ý¨ì¤F§a: ­ì¨Ó¼gµ{¦¡«Ü²³æ:-) ¨C¦¸¥u­nºV´X­Ó¦ü´¿¬Û¦üªº­^¤å¦r :-)) ¥H­è­èÁ|¨Òªº½m²ß¨Ó»¡, ³o¦¸¥u­n·|ºV goto µM«á¥hÂI«ö¨º­ÓÅã¥Üµ{¦¡½X ªü´N¥i¥H¿ï¨ì§A­nªº©R¥O! ¦Ü©ó¸Ó©R¥Oªº¸Ô²Ó»yªk«h»´»´ÂI¤@¤U¸Ó©R¥Oªº­^¤å¦r, µM«á¥ß¨èºV F1 ´N¥i¥H¬Ý¨ì»¡©ú !
¦A¬Ý¬Ý¥H¤U¨Ò¤l... ¥H¤Uµ{¦¡½X¬O¦Û°Ê²£¥Íªº³á! (·íµM§A­nÂI­Ó´X¤U°Õ:-) §Q¥Î¤FCode Snippets(µ{¦¡½X¤ù¬q), ¥H¤Î"Åã¥Üµ{¦¡½X´£¥Ü"¥\¯à! (ª`·N¥H¤Uªºµ{¦¡½X¬O¦Û°Ê²£¥Í¦b³õ´º¤@ªº Actions ¹Ï¼hªº³Ì«á¤@­Ó¼v®æ) ·íµM§Ú¦³¥´¤J¤@¦Cµ{¦¡½X: ¥ý¥´¤F goto µM«á¥ß¨è¥hÂI¨º­Ó"Åã¥Üµ{¦¡½X´£¥Ü", ±µµÛÂI¨â¤U¿ï·Q­nªº!
«Øij¥ý§ì¦^³o godSnippets.xml ¨Ã±q§Aªº°Ê§@­±ªO¶×¤J³oµ{¦¡½X¤ù¬q(·Æ¹««ö¥kÁä¥t¦s·sÀÉ)

¦p¦ó¦Û¤v¼W¥[/½s¼gµ{¦¡½X¤ù¬q(Code Snippets) 

    Flash ¤¹³\§A¦Û¤v¼W¥[±`¥Îªºµ{¦¡½X¤ù¬q(code snippets),
¥ý«ö F9 §â"°Ê§@µ¡"(µ{¦¡½Xµøµ¡)¥s¥X, ÂIÀ» "µ{¦¡½X¤ù¬q", µM«á¸Ó¤pµ¡¥k¤W¨¤¦³­Ó¾¦½üª¬¤p¹Ï¥ÜÂI¤U¥h´N¹ï¤F:
  
¦A¨Ó©O?  ¦Û¤v¸Õ¸Õ°Ú!
¦n°Õ, ¦A¦hÂI»¡©ú, ½Ð¬Ý:
    
 §Ú­Ì¿ï¤F½s¿èµ{¦¡½X¤ù¬q XML 
µM«á§A·|¬Ý¨ì¦³¤@¤d¦h¦æªº XML ©w¸q, XML ¬O¤@ºØ«Ü¹³ºô­¶¥Î HTML ªº¼Ð°O»y¨¥, ¬Ý¤F´N·|À´¤@ÂIÂI:-)
¦b¤@¶}©l´N¦³­ÓªÅ¥Õ½d¨Ò, §A¥i¥H copy/paste ¥h­×§ï§Y¥i:-) ·íµM¤]¥i¥H©¹¤U±²¬Ý¬Ý¨ä¥Lµ{¦¡½X!
­×§ï¦n¤§«á, ¦sÀÉ, µM«á°O±oÂI«öµ{¦¡½X¤ù¬q¤pµ¡¥k¤W¨¤, µM«á¿ï ­«·s¾ã²z 
  

¥H¤U»¡©ú¬O±q©xºô§Û¨Óªº, ·ÓµÛ»¡©úÀ³¸Ó´N¥i¥H°µ¥X¦Û¤vªºµ{¦¡½X¤ù¬q(Code Snippets)

±N·s¤ù¬q·s¼W¦Ü¡uµ{¦¡½X¤ù¬q¡v­±ªO

±z¥i¥H¥Î¨âºØ¤è¦¡±N·sµ{¦¡½X¤ù¬q·s¼W¦Ü¡uµ{¦¡½X¤ù¬q¡v­±ªO¡G
   ¡E ¦b¡u«Ø¥ß·sµ{¦¡½X¤ù¬q¡v¹ï¸Ü¤è¶ô¤¤¿é¤J¤ù¬q¡C
   ¡E ¶×¤Jµ{¦¡½X¤ù¬q XML ÀɮסC
 
­Y­n¨Ï¥Î¡u«Ø¥ß·sµ{¦¡½X¤ù¬q¡v¹ï¸Ü¤è¶ô¡G
 1.¦b¡uµ{¦¡½X¤ù¬q¡v­±ªO¤¤¡A±q­±ªO¿ï³æ¿ï¾Ü¡u«Ø¥ß·sµ{¦¡½X¤ù¬q¡v¡C
 
 2.¦b¹ï¸Ü¤è¶ô¤¤¡A¬°±zªº¤ù¬q¿é¤J¡u¼ÐÃD¡v¡B¡u¤u¨ã´£¥Ü¡v¤å¦r¤Î ActionScript 3.0 µ{¦¡½X¡C
 
 ±z¥i¥H«ö¤@¤U¡u¦Û°Ê¶ñ¦r¡v«ö¶s¡A¥H·s¼W¥ô¦ó¦b¡u°Ê§@¡v­±ªO¤¤¥Ø«e©Ò¿ï¨úªºµ{¦¡½X¡C
 
 3.¦pªG±zªºµ{¦¡½X¥]¬A¦r¦ê "instance_name_here"¡A
   ¦Ó¥B±z§Æ±æ Flash ¦b¤ù¬q®M¥Î®É¥H¥¿½T¹êÅé¦WºÙ¨ú¥N¥¦¡A½Ð¿ï¨ú¡u¦Û°Ê¨ú¥N instance_name_here¡v®Ö¨ú¤è¶ô¡C

 4.¥t¥~, ¦pªGµ{¦¡½X¤ù¬q·|¦b¤@­Ó Flash Àɮפ¤³Q¨Ï¥Î¤£¥u¤@¦¸, ¨º­nª`·N¨ç¼Æ¦WºÙ»P¨ç¼Æ¥~­±ªºÅܼƦWºÙ,
   °O¦í³£¥²¶·­n¥Î fl_ ¶}ÀY, ³o¼Ë­Y­«½Æ¨Ï¥Î¤ù¬q¸Ó¦WºÙ·|¦Û°Ê§ïÅÜ,
   ¤~¤£·|¦³­«½Æ¨ç¼Æ¦WºÙ©Î¬O­«½ÆªºÅܼƦWºÙ¥X²{, 
       ·íµM¦pªG§A¬O§Æ±æ§Y¨Ï­«½Æ¥Î¤]¸Ó¤@¼ËªºÅܼƩΨç¼Æ´N¤£­n¥Î fl_ ¶}ÀY!
   ¦Ü©ó¼g¦b¨ç¼Æ¤ºªº¦WºÙ¤Ï¥¿¬O§½³¡ÅܼÆ(Local variable), ¥i¥H¤£¥²¥Î fl_ ¶}ÀY!
 

Flash ·|±N·s¤ù¬q·s¼W¦Ü¦W¬° Custom ªº¸ê®Æ§¨¤¤¤§¡uµ{¦¡½X¤ù¬q¡v­±ªO¡C
 


­Y­n¶×¤J XML®æ¦¡ªºµ{¦¡½X¤ù¬q¡G
 1.¦b¡uµ{¦¡½X¤ù¬q¡v­±ªO¤¤¡A±q­±ªO¿ï³æ¿ï¾Ü¡u¶×¤Jµ{¦¡½X¤ù¬q XML¡v¡C
 
 2.¿ï¨ú­n¶×¤Jªº XML ÀɮסAµM«á«ö¤@¤U¡u¶}±ÒÂÂÀÉ¡v¡C
   ·íµM§Aªº XML ÀÉ®×¥²¶·¬O·ÓCodeSnippets³W©w®æ¦¡¼¶¼gªº¡C

­Y­n¬d¬Ýµ{¦¡½X¤ù¬qªº¥¿½T XML ®æ¦¡¡A
½Ð±q¡u­±ªO¡v¿ï³æ¿ï¾Ü¡u½s¿èµ{¦¡½X¤ù¬q XML¡v¡C
«Øij: ¥ý§ì¦^³o godSnippets.xml ¨Ã±q§Aªº°Ê§@­±ªO¶×¤J³oµ{¦¡½X¤ù¬q(·Æ¹««ö¥kÁä¥t¦s·sÀÉ) ±q°Ê§@­±ªO¶×¤JºÏºÐ¤¤ªº XML ÀÉ®×(µ{¦¡½X¤ù¬q) ­Y­n§R°£µ{¦¡½X¤ù¬q¡A ½Ð¥H·Æ¹«¥kÁä«ö¤@¤U­±ªO¤¤ªºµ{¦¡½X¤ù¬q¡A±q§ÖÅã¿ï³æ¤¤¿ï¾Ü¡u§R°£µ{¦¡½X¤ù¬q¡v¡C ­Y­n¦Û¤v¥Î¤å¦r½s¿è¾¹(¦p notepad )½s¿è¦Û¤vªºµ{¦¡½X¤ù¬q¡A ¥i¥H¥ý¶×¥Xµ{¦¡½X¤ù¬q¬° XML ÀÉ®×, µy·L¬Ý¬Ý´N·|«Ø¥ß¦Û¤vªºµ{¦¡½X¤ù¬q, ¤T¤£¤­®ÉÁÙ¥i¥H¨ìºô¸ô©ÎªB¤Í³B»`¶°µ{¦¡½X¤ù¬q¥[¶i¥h :-) «Øij¤À¶}¤£¦PªºÀɮ׫إß, ¶×¤J®É¥i¥H¶×¤J¦h­Ó XML ÀÉ®×, §Ë¶Ã¤F¥i¥H¦^´_¨ì­ì¥ý¤ù¬q! ­nª`·Nªº¯S®íÅܼƦWºÙ instancs_name_here ¬O«ü·í§A­n¨D¥ýÂIª«¥ó¤~¥Í¥Xµ{¦¡½X¤§®É¸Óª«¥ó¦WºÙ, Flash ·|¦Û°Ê§ï¬°¸Ó¹êÅé¦WºÙ, ¦pªG§AÁÙ¨S©R¦W, FLash ÁÙ·|À°§A©R¦W! ¥t¥~, ¦pªGµ{¦¡½X¤ù¬q·|¦b¤@­ÓFlash¤¤¨Ï¥Î¤£¥u¤@¦¸, ¨º­nª`·N¨ç¼Æ¦WºÙ»P¨ç¼Æ¥~­±ªºÅܼƦWºÙ, °O¦í³£¥²¶·­n¥Î fl_ ¶}ÀY, ³o¼Ë­Y­«½Æ¨Ï¥Î¤ù¬q¸Ó¦WºÙ·|¦Û°Ê§ïÅÜ, ¤~¤£·|¦³­«½Æ¨ç¼Æ¦WºÙ©Î¬O­«½ÆªºÅܼƦWºÙ¥X²{, ·íµM¦pªG§A¬O§Æ±æ§Y¨Ï­«½Æ¥Î¤]¸Ó¤@¼ËªºÅܼƩΨç¼Æ´N¤£­n¥Î fl_ ¶}ÀY! ¦Ü©ó¼g¦b¨ç¼Æ¤ºªº¦WºÙ¤Ï¥¿¬O§½³¡ÅܼÆ(Local variable), ¥i¥H¤£¥²¥Î fl_ ¶}ÀY! ¥H¤U¬O¤@­Ó²³æ code snippets µ{¦¡½X¤ù¬q XML ÀÉ®×½d¨Ò:

<?xml version="1.0" encoding="UTF-8"?>
<CodeSnippets>
<snippets>


  <category title="Week10_½m²ßÃD­n¥Î..." 
       description="¦³¨Ç¬O¨ç¼Æ, ¦³¨Ç¬O¤ù¬q..."
       isBranch="true"  expanded="false">


    <snippet isBranch="false">
       <title>¦Û­qªº¤ù¬q</title>
       <description>¤£¥Î instance_name_here</description>
       <requiresSymbol>false</requiresSymbol>
       <code><![CDATA[
           // .. ³o¸Ì¼g¦Û­qµ{¦¡½X¤ù¬q
           trace("¦Û­qµ{¦¡½X¤ù¬q, ¤£»Ý­n¥ý«ü©wª«¥ó"); // ¥i§â³oµù¸Ñ±¼
           // ¦pªG§A»Ý­n¤@¨ÇÅܼÆ, ½Ð¨Ï¥Î fl_ ¶}ÀY, ¨Ò¦p fl_ggyy
           // ³o¼Ëªº¦n³B¬O·í§A­«½Æ¨Ï¥Î³o¤ù¬q®É, fl_ggyy ·|¦Û°ÊÅܤ£¦PªºÅܼÆ,
           // ¨Ò¦p, fl_ggyy2, fl_ggyy3, ...
           // ¦pªG§A§Æ±æ¨C¦¸¨Ï¥Î³£¬O¥Î¦P¤@­ÓÅܼÆ, ¨º´N¤£­n¥Î fl_ ¶}ÀY§Y¥i,
           // ÁÙ¦³, ÅÜ¼Æ instance_name_here ¬O¥Nªí§A«ü©wªºª«¥ó¹êÅé¦WºÙ
           
        ]]></code>
    </snippet>

    <snippet isBranch="false">
       <title>¦Û­qªº¤ù¬q</title>
       <description>¦Û­qªº¤ù¬qµ{¦¡½X¥i¥Î¤@­Óª«¥óÅÜ¼Æ instance_name_here</description>
       <requiresSymbol>true</requiresSymbol>
       <code><![CDATA[
           // .. ³o¸Ì¼g¦Û­qµ{¦¡½X¤ù¬q
           trace("¦Û­qµ{¦¡½X¤ù¬q" + instance_name_here); // ¥i§â³oµù¸Ñ±¼
           //.. ¥i¥H¨Ï¥Î instance_name_here ¹ïÀ³¨ì <requiresSymbol>true</requiresSymbol>
           // ¦pªG§A»Ý­n¤@¨ÇÅܼÆ, ½Ð¨Ï¥Î fl_ ¶}ÀY, ¨Ò¦p fl_ggyy
           // ³o¼Ëªº¦n³B¬O·í§A­«½Æ¨Ï¥Î³o¤ù¬q®É, fl_ggyy ·|¦Û°ÊÅܤ£¦PªºÅܼÆ,
           // ¨Ò¦p, fl_ggyy2, fl_ggyy3, ...
           // ¦pªG§A§Æ±æ¨C¦¸¨Ï¥Î³£¬O¥Î¦P¤@­ÓÅܼÆ, ¨º´N¤£­n¥Î fl_ ¶}ÀY§Y¥i,
           // ÁÙ¦³, ÅÜ¼Æ instance_name_here ¬O¥Nªí§A«ü©wªºª«¥ó¹êÅé¦WºÙ
        ]]></code>
    </snippet>

  </category>


</snippets>
</CodeSnippets>

    

 Top

§ó¦hªº»¡©ú¥i¥HÂI³o¬Ý Adobe ªº»¡©ú¤â¥U !
«Øij¥ý§ì¦^³o godSnippets.xml ¨Ã±q§Aªº°Ê§@­±ªO¶×¤J³oµ{¦¡½X¤ù¬q(·Æ¹««ö¥kÁä¥t¦s·sÀÉ)
¾aÀ\! ¬°¦ó¥´¤@¨Ç¦r«áÂI«ö¤£Åã¥Üµ{¦¡½X´£¥Ü?
®Ú¾Ú¸ôÃäªÀºî¦X«Ü¦h¤Hªº»¡ªk:
    °O¾ÐÅ餣°÷¥Î°Õ, µLªk«Ø¥ßµ{¦¡½X´£¥Ü§Ö¨ú(Cache; Ū°µ cash; ¸ò"²{ª÷"¦P­µ; ¤£¬OŪ¦¨ catch ³á!),
¦]¬°§A¨º­Ó .fla Àɮשҩñªº¥Ø¿ý¤¤¦³¤Ó¦hÀÉ®×(¥]¬A§Oªº¤l¥Ø¿ý)!
¯uªº¬O¾aÀ\£° .. ³o¬OÔ£³¾²z¥Ñ? ®ÇÃä¥Ø¿ý¤º«Ü¦hÀɮפ]¤£¦æ?!
¸Ñ¨M¤èªk: 
     (a)»°§Ö¥ý¦sÀÉ¥H§K¥Õ°µ¤u
     (b)Ãö³¬ Flash
     (c)§ä¤@­Ó®ÇÃä¨S¤Hªº©Ò¦b: ·s«Ø¥ß¤@­ÓªÅªº¥Ø¿ý(¦b¥ô¦ó¦a¤è³£¥i¥H)
     (d)§â§Aªº Flash .fla ÀÉ®×¥H¤Î¬ÛÃöªºÀÉ®×·h¨ì¨º­ÓªÅ¥Ø¿ý
     (e)­«·s±Ò°Ê Flash ¨Ã¥´¶}¦b¸Ó·s¥Ø¿ýªº Flash .fla ÀÉ®×  

¦n¤F!
¸ÕµÛ«ö F9 ¥s¥X Action °Ê§@½X(¸}¥»)µ¡,
µM«áºV¤J nexts¨Ã¥ß¨è¥hÂI«ö¤p¹Ï¥Ü
¬Ý¬Ý·|¤£·|Åã¥Ü Code Hint (µ{¦¡½X´£¥Ü)
¹³¥kÃ䪺¹Ï©ÒÅã¥Üªº!



Sinppet ·N«ä¬O¤ù¬q, ¸H¤ù; 
     snip ·N«ä¬O°Å¤U, pet ·N«ä¬OÃdª«;



 Top

¦p¦ó¦Û»s«ö¶s?
       ¦b Flash ¤¤ªº«ö¶s¤¸¥ó(Button Symbol)¨ä¹ê¬O¯S®íªº¼v¤ù¤ù¬q, §t¦³¥|­Ó¼v®æ,
   ¤À§O¬O¤@¯ë¡B·Æ¤J¡B«ö¤U¡A¥H¤Î·PÀ³°Ï¡C³q±`¤£¥²ºÞ·PÀ³°Ïªº¼v®æ, 
   ·íµM¡A¦pªG§A­nÅý·Æ¹«·PÀ³°Ï»P¹ê»Ú«ö¶s¦ì¸m¤£¦P, «h¥i¥H¦b·PÀ³°Ï¼v®æ¬G·Nµe¤£¦P°Ï°ì !
   ¥H¤U¥H "§Ú¸Ó¦³´X¤À" ³o«ö¶s¬°¨Ò¡A¨ä¥L¥i¥H¦b¤¸¥ó®w¤º¥Î "­«»s" ¦A­×§ï!
    (a)«ö¤U Ctrl_F8 ªí¥Ü­n«Ø¥ß·s¤¸¥ó(Symbol)
       ·íµM­n¿ï«ö¶s¡A¥Îµe¯x§Î¤u¨ã§Ë¦¨¶ê¶êªº¨¤¡A
       ¥Î T ¤å¦r¤u¨ã¼g¦r, «Øij¤À¶}©ñ¤£¦P¹Ï¼h !
   

    (b)·Æ¤J®É «ö¶sÃC¦â»P¤å¦rÃC¦â ³£­n§ï!
   

    (c)«ö¤Uªº¼v®æ¥²¶·¥þ¿ï«á¥ÎÁä½L©¹¤UÁä§â¾ã­Ó¹Ï®×©¹¤U²¾°Ê 5 ¹³¯À (Pixal)!
       «ö¶sÃC¦â»P¤å¦rÃC¦â¤]³£­n§ï!
   

 ¥t¥~, ¶¶«K¬Ý¬Ý¦p¦ó¥Î DreamWeaver »s§@ºô­¶¥Îªº"°ÊºA¦¡«ö¶s"(¨ä¹ê´N¬O°½´«¹Ï¤ù)


 Top


©ì©Ôª«¥ó©ñ±¼«á¦p¦óª¾¹D©ñ¦bÔ£ªF¦è¤W? 

    «Ü¦h¤H·|¥H¬°³o¬O¸I¼²°»´ú(collision detection), ¨ä¹ê¤£¬O!
³o¥u¬O¬Ý¬Ý§A°±¤î©ì©Ô(stopDrag)¤§«á, ¨ì©³§âª«¥ó©ñ¦b­þ­Ó"Åã¥Üª«¥ó®e¾¹"¤W,               
©Ò¥H¥¿½Tªº°µªk¬OÀˬd§Aªº dropTarget, ¨Ò¦p:
      if( haha_mc.dropTarget.parent.name == "backware") {
           // do something
      } 
  ½Ðª`·N, ¤£­n¼g¦¨
      if( haha_mc.dropTarget.name == "backware")  ... 
  ³o¼Ë¥Ã»·¤£·|¬d±o¨ì! ­ì¦]¬O¥¦¦³"®e¾¹"ªº·§©À!

  ¬Æ¦Ü, ¦pªG target ª«¥ó«Ü½ÆÂø, §A¥i¯à­n¼g¦¨¥H¤U³o¼Ë¤~¬d±o¨ì:
      if( haha_mc.dropTarget.parent.parent.name == "backware") {
           // do something
      } 

ÂI³o¬Ý Adobe AS3  flash.display.DisplayObject Åã¥Üª«¥óÃþ§Oªº °Ñ¦Ò¤â¥U


ÂI³o¬Ý Adobe AS3  flash.display.DisplayObjectContainer Åã¥Üª«¥ó®e¾¹Ãþ§Oªº °Ñ¦Ò¤â¥U



 Top


¸I¼²°»´ú hitTestObject(ª«¥ó) »P hitTestPointer(X®y¼Ð, Y®y¼Ð)
    ¦b AS2 ®É¥Nªº hitTest( ) ¨ç¼Æ¨ì¤F AS3 ³Q©î¶}¬°¨â­Ó¨ç¼Æ:
hitTestObject(ª«¥ó); »P hitTestPointer(X®y¼Ð, Y®y¼Ð);

   hitTestObject¡G §PÂ_¼v¤ù¤ù¬q©M«ü©wª«¥óªºªº½d³ò®Ø¬O§_¦³­«Å|©Î¬Û¥æ¡C
      ¦]¬°¨ä¹êª«¥ó³£¬O¤è§Î½d³ò, ©Ò¥H¦³®É¬Ý°_¨Ó¨S¸I¼²¤]·|³Q°»´ú¬°¤w¸g¼²¨ì! ½d¨Ò:
         if( my_mc.hitTestObject( your_mc ) {
               // ¼²¨ì¤F, do something
         }

   hitTestPoint¡G ÅU¦W«ä¸q, ¥u°»´ú¤@­ÓÂI¬O§_¦bª«¥óªº§Îª¬½d³ò¤º;
      ³o®É§A¥i¥Hµ¹²Ä¤T­Ó°Ñ¼Æ¬° true ¥H«K¯uªº¥u°»´ú¦³¹³¯À³¡¥÷, ¨Ò¦p:
         if( my_mc.hitTestPointer( mouseX, mouseY, true) {
              // do something
         } 
   ¦ý¬O³o¥u¹ï©ó¦V¶q¹Ï¦³®Ä, ¦pªG¬OÂI°}¹Ï(bitmap; .bmpÀÉ®×)«h¨S¦³¥Î, ¤´¬O°»´ú¤è«¬½d³ò¡C
   ³o¬O¦]¬°ÂI°}¹Ïªº¹ÏÀɸê®Æ¤¤¨Ã¨S¦³°O¿ý¦ó³B¬O¯uªº¦³¸ê®Æ, ©Ò¦³ªº0»P1³£¬O¹Ïªº¸ê®Æ, µLªk¤À¿ë!


§ó¦hÃö©ó¸I¼²°»´úªº½d¨Ò»P¶i¶¥°Q½×, ½ÐÂI¥H¤Uºô§}³s¹L¥h¬Ý: 
http://sierakowski.eu/list-of-tips/39-collision-detection-methods-hittest-and-hittestobject-alternatives.html
¥H¤U¬O¨Ó¦Û¸Óºô­¶ªº½d¨Ò:



















Corey O'Neil's Collision Detection Kit...
 
I think this one is currently the most popular... 
You can download it from 
here: http://code.google.com/p/collisiondetectionkit/downloads/list. 
It's very easy to implement, very efficient and works great. 

The documentation with simple examples is available 
here: http://www.coreyoneil.com/Flash/CDK/documentation/
 
I have modified my code from the first project again.









 Top

¦p¦ó¨Ï¥Î ActionScript ½d¨Ò (Flash As3)
°Ñ¦Ò:

http://help.adobe.com/zh_TW/as3/dev/WS9b644acd4ebe5999-2734bf3c124372a52ff-8000.html

ÁA¸Ñ¯S©wÃþ§O©M¤èªk¹B§@¤è¦¡ªº³Ì¨Î¤èªk¤§¤@¡A´N¬O°õ¦æ ActionScript 3.0 µ{¦¡½X½d¨Ò¡C±z¥i¥H®Ú¾Ú¨Ï¥Îªº¸Ë¸m©Î¥Ø¼Ð¸Ë¸m¡A¥H¤£¦P¤è¦¡¨Ï¥Î½d¨Ò¡C

°õ¦æ Flash Professional ©Î Flash Builder ªº¹q¸£
½Ð°Ñ¾\¦b Flash Professional °õ¦æ ActionScript 3.0 ½d¨Ò©Î¦b Flash Builder °õ¦æ ActionScript 3.0 ½d¨Ò¡A¨ú±o¦³Ãö¦p¦ó¦b³o¨Ç¶}µoÀô¹Ò°õ¦æ ActionScript 3.0 ½d¨Òªº¸ê°T¡C¨Ï¥Î trace ³¯­z¦¡¥H¤Î¨ä¥L°£¿ù¤u¨ã¡A¥i¼W¥[±z¹ï©óµ{¦¡½X½d¨Ò¹B§@¤è¦¡ªºÁA¸Ñ¡C

¦æ°Ê¸Ë¸m
±z¥i¥H¦b¤ä´© Flash Player 10.1 ¤Î§ó·sª©¥»ªº¦æ°Ê¸Ë¸m¤W°õ¦æ ActionScript 3.0 µ{¦¡½X½d¨Ò¡C½Ð°Ñ¾\¦b¦æ°Ê¸Ë¸m°õ¦æ ActionScript 3.0 ½d¨Ò¡C±z¤]¥i¥H¦b°õ¦æ Flash Professional ©Î Flash Builder ªº¹q¸£¤W°õ¦æ³o¨Ç½d¨Ò¡C

¹qµø¾÷
ÁöµM±zµLªk¦b¹qµø¾÷°õ¦æ³o¨Ç½d¨Ò¡A¦ýÁÙ¬O¥i¥H¦b¹q¸£°õ¦æ¡A¥H«K±q½d¨Ò¤¤¾Ç²ß¡C½Ð°Ñ¾\ Adobe Developer Connection ºô¯¸¤Wªº¹qµøª© Flash Platform¡A¨ú±o¦³Ãö¶}µo¹qµø¾÷±M¥ÎÀ³¥Îµ{¦¡ªº¸ê°T¡C

½d¨ÒÃþ«¬

ActionScript 3.0 µ{¦¡½X½d¨ÒªºÃþ«¬¡G

µ{¦¡½X¤ù¬q½d¨Ò

µ{¦¡½X¤ù¬q¬Ý°_¨Ó¦p¤U¡G

var x:int = 5; 
trace(x); // 5

µ{¦¡½X¤ù¬q¥]§tªºµ{¦¡½X¡A¥u¬O¥Î©ó®i¥Ü¤@ºØ·Qªk¡C¥¦­Ì³q±`¤£·|¥]§t®M¥ó©ÎÃþ§O³¯­z¦¡¡C

Ãþ§O½d¨Ò

«Ü¦h½d¨ÒÅã¥Ü§¹¾ã ActionScript Ãþ§Oªº­ì©l½X¡CÃþ§O½d¨Ò¬Ý°_¨Ó¦p¤U¡G

package { 
    public class Example1 { 
        public function Example1():void { 
            var x:int = 5; 
            trace(x); //5 
        } 
    } 
}

Ãþ§O½d¨Òªºµ{¦¡½X¥]§t¤@­Ó®M¥ó³¯­z¦¡¡BÃþ§O«Å§i¥H¤Î¤@­Ó«Øºc¨ç¦¡¡C

¥]§t¦h­Ó­ì©l½XÀÉ®×(Source file)ªº¹ê»Ú½d¨Ò

¡mActionScript 3.0 ¶}µo¤H­û«ü«n¡n¤¤ªº«Ü¦h¥DÃD·|¥H¹ê»Ú½d¨Ò°µ¬°Á`µ²¡A³o¨Ç½d¨ÒÅã¥Ü¦p¦ó¦b¹ê»ÚÀô¹Ò¤¤¨Ï¥Î¯S©wªº ActionScript ¥\¯à¡C³o¨Ç½d¨Ò³q±`¤º§t¦h­ÓÀɮסA¨ä¤¤¥]¬A¡G

  • ¤@©Î¦h­Ó ActionScript ­ì©l½XÀÉ®×(Source file)

  • Flash Professional ¨Ï¥Îªº .FLA ÀÉ®×

  • ¤@©Î¦h­Ó Flash Builder ¨Ï¥Îªº MXML ÀÉ®×

  • ½d¨ÒÀ³¥Îµ{¦¡¨Ï¥Îªº¸ê®ÆÀɮסB¼v¹³ÀɮסB­ì©l½XÀÉ®×(Source file)©ÎªÌ¨ä¥L¸ê·½ (¿ï¾Ü©Ê)¡C

¹ê»Ú½d¨Ò¤@¯ë·|¥H ZIP «Ê¦sÀÉ®×´£¨Ñ¡C

¶}µo¤H­û«ü«nªº½d¨Ò ZIP ÀɮײM³æ

Flash Professional CS5 ©M Flex 4 ªº ZIP ÀÉ®× (½Ð±q www.adobe.com/go/learn_programmingAS3samples_flash_tw ¤U¸ü) ¥]§t¤U¦C½d¨Ò¡G

¦b¡uFlash ¶}µo¤H­û¤¤¤ß¡v©M¡uFlex ¶}µo¤H­û¤¤¤ß¡v¤¤¤]¥i¥H§ä¨ì«Ü¦h»P¡u§Ö³t¤Jªù¡v¤å³¹¦³Ãöªº¹ê»Ú½d¨Ò¡C

¦b Flash Professional °õ¦æ ActionScript 3.0 ½d¨Ò

¨Ï¥Î¤U¦C¨ä¤¤¤@­Óµ{§Ç (µø½d¨ÒÃþ«¬¦Ó©w) ¥i°õ¦æ¨Ï¥Î Flash Professional ªº½d¨Ò¡C

¦b Flash Professional °õ¦æµ{¦¡½X¤ù¬q½d¨Ò

¦b Flash Professional °õ¦æµ{¦¡½X¤ù¬q½d¨Ò¡G

  1. ¿ï¨ú¡uÀÉ®× > ·s¼W¡v¡C

  2. ¦b¡u·s¼W¤å¥ó¡v¹ï¸Ü¤è¶ô¤¤¿ï¨ú¡uFlash ¤å¥ó¡v¡AµM«á«ö¤@¤U¡u½T©w¡v¡C

    ·sªº Flash µøµ¡ÀH§YÅã¥Ü¡C

  3. «ö¤@¤U¡u®É¶¡¶b¡v­±ªO¤¤²Ä¤@­Ó¹Ï¼hªº²Ä¤@­Ó¼v®æ¡C

  4. ¦b¡u°Ê§@¡v­±ªO¤¤¡A¿é¤J©Î¶K¤Wµ{¦¡½X¤ù¬q½d¨Ò¡C

  5. ¿ï¨ú¡uÀÉ®× > Àx¦s¡v¡C¿é¤JÀɮתº¦WºÙ¡AµM«á«ö¤@¤U¡u½T©w¡v¡C

  6. ­Y­n´ú¸Õ½d¨Ò¡A½Ð¿ï¨ú¡u±±¨î > ´ú¸Õ¼v¤ù¡v¡C

¦b Flash Professional °õ¦æÃþ§O½d¨Ò

¦b Flash Professional °õ¦æÃþ§O½d¨Ò¡G

  1. ¿ï¨ú¡uÀÉ®× > ¶}·sÀɮסv¡C

  2. ¦b¡u·s¼W¤å¥ó¡v¹ï¸Ü¤è¶ô¤¤¿ï¨ú¡uActionScript Àɮסv¡AµM«á«ö¤@¤U¡u½T©w¡v¡C·sªº½s¿è¾¹µøµ¡ÀH§YÅã¥Ü¡C

  3. ±NÃþ§O½d¨Òµ{¦¡½X½Æ»s«á¶K¨ì½s¿è¾¹µøµ¡¡C

    ¦pªG¦¹Ãþ§O¬Oµ{¦¡ªº¥D­n¤å¥óÃþ§O¡A¥¦¥²¶·ÂX¥R MovieClip Ãþ§O¡G

    import flash.display.MovieClip; 
    public class Example1 extends MovieClip{ 
    //... 
    }

    ¥t¥~½Ð½T©w¦b½d¨Ò¤¤°Ñ·Óªº©Ò¦³Ãþ§O³£·|¨Ï¥Î import ³¯­z¦¡¨Ó«Å§i¡C

  4. ¿ï¨ú¡uÀÉ®× > Àx¦s¡v¡C±NÀɮתº¦WºÙ«ü©w¬°½d¨Ò¤¤¬Û¦PªºÃþ§O¦WºÙ (¨Ò¦p ContextMenuExample.as)¡C
    ³Æµù¡G ¬Y¨ÇÃþ§O½d¨Ò¡A¨Ò¦p flashx.textLayout.container.ContainerController Ãþ§O½d¨Ò¡A¦b®M¥ó«Å§i¤¤¥]§t¦h­Ó¶¥¼h (package flashx.textLayout.container.examples {)¡C¹ï©ó³o¨Ç½d¨Ò¡A¥u­n±NÀÉ®×Àx¦s¦b²Å¦X«Ê¸Ë«Å§i (flashx/textLayout/container/examples) ªº¤l¸ê®Æ§¨¤¤¡A©Î²¾°£«Ê¸Ë¦WºÙ (³o¼Ë ActionScript ·|¥u¥H package { ¶}ÀY)¡A±z´N¥i¥H±q¥ô¦ó¦ì¸m´ú¸ÕÀɮסC
  5. ¿ï¨ú¡uÀÉ®× > ¶}·sÀɮסv¡C

  6. ¦b¡u·s¼W¤å¥ó¡v¹ï¸Ü¤è¶ô¤¤¿ï¨ú¡uFlash ¤å¥ó (ActionScript 3.0)¡v¡AµM«á«ö¤@¤U¡u½T©w¡v¡C·sªº Flash µøµ¡ÀH§YÅã¥Ü¡C

  7. ¦b¡uÄÝ©Ê¡v­±ªO¤¤ªº¡u¤å¥óÃþ§O¡vÄæ¦ì¡A¿é¤J½d¨ÒÃþ§Oªº¦WºÙ¡A¦¹¦WºÙ´N¬O­è¤~Àx¦sªº ActionScript ­ì©l½XÀÉ®×(Source file)¦WºÙ (¨Ò¦p ContextMenuExample)¡C

  8. ¿ï¨ú¡uÀÉ®× > Àx¦s¡v¡C±N FLA Àɮתº¦WºÙ«ü©w¬°½d¨Ò¤¤¬Û¦PªºÃþ§O¦WºÙ (¨Ò¦p ContextMenuExample.fla)¡C

  9. ­Y­n´ú¸Õ½d¨Ò¡A½Ð¿ï¨ú¡u±±¨î > ´ú¸Õ¼v¤ù¡v¡C

¦b Flash Professional °õ¦æ¹ê»Ú½d¨Ò

¹ê»Ú½d¨Ò¤@¯ë·|¥H ZIP «Ê¦sÀÉ®×´£¨Ñ¡C¨Ï¥Î Flash Professional °õ¦æ¹ê»Ú½d¨Ò¡G

  1. ±N«Ê¦sÀɮ׸ÑÀ£ÁY¦Ü¿ï¾Üªº¸ê®Æ§¨¡C

  2. ¦b Flash Professional ¤¤¡A¿ï¨ú¡uÀÉ®× > ¶}±Ò¡v¡C

  3. ÂsÄý«Ê¦sÀÉ®×­n¸ÑÀ£ÁYªº¸ê®Æ§¨¡C¿ï¨ú¸ê®Æ§¨¤¤ªº FLA ÀɮסAµM«á«ö¤@¤U¡u¶}±Ò¡v¡C

  4. ­Y­n´ú¸Õ½d¨Ò¡A½Ð¿ï¨ú¡u±±¨î > ´ú¸Õ¼v¤ù¡v¡C

¦b Flash Builder °õ¦æ ActionScript 3.0 ½d¨Ò

¨Ï¥Î¤U¦C¨ä¤¤¤@­Óµ{§Ç (µø½d¨ÒÃþ«¬¦Ó©w) ¥i°õ¦æ¨Ï¥Î Flash Builder ªº½d¨Ò¡C

¦b Flash Builder °õ¦æµ{¦¡½X¤ù¬q½d¨Ò

¦b Flash Builder °õ¦æµ{¦¡½X¤ù¬q½d¨Ò¡G

  1. «Ø¥ß·sªº Flex ±M®× (¿ï¨ú¡u ÀÉ®× > ·s¼W > Flex ±M®×¡v) ©ÎªÌ¦b²{¦³ªº Flex ±M®×¤¤«Ø¥ß·sªº MXML À³¥Îµ{¦¡ (¿ï¨ú¡uÀÉ®× > ·s¼W > MXML À³¥Îµ{¦¡¡v)¡C¬°±M®×©ÎÀ³¥Îµ{¦¡«ü©w´y­z©Ê¦WºÙ (¨Ò¦p ContextMenuExample)¡C

  2. ¦b²£¥Íªº MXML Àɮפ¤¡A·s¼W¤@­Ó <mx:Script> ¼ÐÅÒ¡C

  3. ±Nµ{¦¡½X¤ù¬q¤º®e¶K¨ì <mx:Script> ©M </mx:Script> ¼ÐÅÒ¤§¶¡¡CÀx¦s MXML ÀɮסC

  4. ­Y­n°õ¦æ½d¨Ò¡A½Ð¿ï¨ú¡u°õ¦æ > ¥D­n MXML Àɮתº°õ¦æ¥\¯àªí¿ï¶µ¡v(¨Ò¦p¡u°õ¦æ > °õ¦æ ContextMenuExample)¡v¡C

¦b Flash Builder °õ¦æÃþ§O½d¨Ò

¦b Flash Builder °õ¦æÃþ§O½d¨Ò¡G

  1. ¿ï¨ú¡uÀÉ®× > ·s¼W > ActionScript ±M®×¡v¡C

  2. ¦b¡u±M®×¦WºÙ¡vÄæ¦ì¤¤¿é¤J¥D­nÃþ§Oªº¦WºÙ (¨Ò¦p ContextMenuExample)¡C¨ä¥LÄæ¦ì¨Ï¥Î¹w³]­È (©ÎªÌ®Ú¾Ú±zªº¯S®íÀô¹Ò¡AÅܧ󥦭Ì)¡C«ö¤@¤U¡u§¹¦¨¡v¡A«Ø¥ß±M®×¥H¤Î¥D­nªº ActionScript ÀɮסC

  3. À¿°£ ActionScript Àɮפ¤¥ô¦ó²£¥Íªº¤º®e¡C±N¥]¬A®M¥ó©M¶×¤J³¯­z¦¡ªº½d¨Òµ{¦¡½X¶K¨ì ActionScript Àɮפ¤¡AµM«áÀx¦sÀɮסC

    ³Æµù¡G ¬Y¨ÇÃþ§O½d¨Ò¡A¨Ò¦p flashx.textLayout.container.ContainerController Ãþ§O½d¨Ò¡A¦b®M¥ó«Å§i¤¤¥]§t¦h­Ó¶¥¼h (package flashx.textLayout.container.examples {)¡C¹ï©ó³o¨Ç½d¨Ò¡A¥u­n±NÀÉ®×Àx¦s¦b²Å¦X«Ê¸Ë«Å§i (flashx/textLayout/container/examples) ªº¤l¸ê®Æ§¨¤¤¡A©Î²¾°£«Ê¸Ë¦WºÙ (³o¼Ë ActionScript ·|¥u¥H package { ¶}ÀY)¡A±z´N¥i¥H±q¥ô¦ó¦ì¸m´ú¸ÕÀɮסC
  4. ­Y­n°õ¦æ½d¨Ò¡A½Ð¿ï¨ú¡u°õ¦æ > ¥D­n ActionScript Ãþ§O¦WºÙªº°õ¦æ¥\¯àªí¿ï¶µ¡v(¨Ò¦p¡u°õ¦æ > °õ¦æ ContextMenuExample)¡v¡C

¦b Flash Builder °õ¦æ¹ê»Ú½d¨Ò

¹ê»Ú½d¨Ò¤@¯ë·|¥H ZIP «Ê¦sÀÉ®×´£¨Ñ¡C¨Ï¥Î Flash Builder °õ¦æ¹ê»Ú½d¨Ò¡G

  1. ±N«Ê¦sÀɮ׸ÑÀ£ÁY¦Ü¿ï¾Üªº¸ê®Æ§¨¡C¬°¸ê®Æ§¨«ü©w´y­z©Ê¦WºÙ (¨Ò¦p ContextMenuExample)¡C

  2. ¦b Flash Builder ¤¤¡A¿ï¨ú¡uÀÉ®× > ·s¼W Flex ±M®×¡v¡C¦b¡u±M®×¦ì¸m¡v³¡¤À¤¤¡A«ö¤@¤U¡uÂsÄý¡v¡AµM«á¿ï¨ú¤º§t½d¨ÒÀɮתº¸ê®Æ§¨¡C¦b¡u±M®×¦WºÙ¡vÄæ¦ì¤¤¡A¿é¤J¸ê®Æ§¨¦WºÙ (¨Ò¦p ContextMenuExample)¡C ¨ä¥LÄæ¦ì¨Ï¥Î¹w³]­È (©ÎªÌ®Ú¾Ú±zªº¯S®íÀô¹Ò¡AÅܧ󥦭Ì)¡C«ö¡u¤U¤@¨B¡vÄ~Äò¡C

  3. ¦b¡u¿é¥X¡v­±ªO¤¤«ö¡u¤U¤@¨B¡v¡A±µ¨ü¹w³]­È¡C

  4. ¦b¡u¨Ó·½¸ô®|¡v­±ªO¤¤«ö¤@¤U¡u¥D­nÀ³¥Îµ{¦¡ÀɮסvÄæ¦ì®ÇÃ䪺¡uÂsÄý¡v«ö¶s¡C±q½d¨Ò¸ê®Æ§¨¿ï¨ú¥D­n MXML ½d¨ÒÀɮסC«ö¤@¤U¡u§¹¦¨¡v¨Ó«Ø¥ß±M®×ÀɮסC

  5. ­Y­n°õ¦æ½d¨Ò¡A½Ð¿ï¨ú¡u°õ¦æ > ¥D­n MXML Àɮתº°õ¦æ¥\¯àªí¿ï¶µ¡v(¨Ò¦p¡u°õ¦æ > °õ¦æ ContextMenuExample)¡v¡C

¦b¦æ°Ê¸Ë¸m°õ¦æ ActionScript 3.0 ½d¨Ò

±z¥i¥H¦b¤ä´© Flash Player 10.1 ªº¦æ°Ê¸Ë¸m°õ¦æ ActionScript 3.0 µ{¦¡½X½d¨Ò¡C¤£¹L¡A¤@¯ë±z¥i¥H°õ¦æµ{¦¡½X½d¨Ò¡A«K¯à±oª¾¯S©wÃþ§O©M¤èªkªº¹B§@¤è¦¡¡C¦b³oºØ±¡ªp¤U¡A¦b®à¤W«¬¹q¸£¤§Ãþªº«D¦æ°Ê¸Ë¸m°õ¦æ½d¨Ò¡C¦b®à¤W«¬¹q¸£¤W¡A±z¥i¥H¦b Flash Professional ©Î Flash Builder ¨Ï¥Î trace ³¯­z¦¡¥H¤Î¨ä¥L°£¿ù¤u¨ã¡A¼W¥[±z¹ï©óµ{¦¡½X½d¨ÒªºÁA¸Ñ¡C

­Y±z·Q¦b¦æ°Ê¸Ë¸m¤W°õ¦æ½d¨Ò¡A¥i¥H±NÀɮ׽ƻs¨ì¸Ë¸m©Îºô¯¸¦øªA¾¹¡C­Y­n±NÀɮ׽ƻs¨ì¸Ë¸m¡AµM«á¦bÂsÄý¾¹¤¤°õ¦æ½d¨Ò¡A½Ð°õ¦æ¥H¤U¨BÆJ¡G

  1. «ö·Ó¦b Flash Professional °õ¦æ ActionScript 3.0 ½d¨Ò©Î¦b Flash Builder °õ¦æ ActionScript 3.0 ½d¨Ò¤¤ªº«ü¥Ü¡A°õ¦æ¥H¤U¨BÆJ¡C ¦b Flash Professional ¤¤¡A·í±z¿ï¨ú¡u±±¨î > ´ú¸Õ¼v¤ù¡v¡A´N¥i¥H«Ø¥ß SWF ÀɮסC¦b Flash Builder ¤¤¡A·í±z°õ¦æ¡B°£¿ù©Î«Ø¥ß¦Û¤vªº Flash Builder ±M®×®É¡A´N¥i¥H«Ø¥ß SWF ÀɮסC

  2. ±N SWF Àɮ׽ƻs¨ì¦æ°Ê¸Ë¸m¤Wªº¥Ø¿ý¡C¨Ï¥Î¸Ë¸m´£¨Ñªº³nÅé¨Ó½Æ»sÀɮסC

  3. ¦b¦æ°Ê¸Ë¸mªºÂsÄý¾¹¦ì§}¦C¡A¿é¤J SWF Àɮתº file:// URL¡C¨Ò¦p¡A¿é¤J file:://applications/myExample.swf¡C

­Y­n±NÀɮ׽ƻs¨ìºô¯¸¦øªA¾¹¡AµM«á¦b¸Ë¸mªºÂsÄý¾¹¤¤°õ¦æ½d¨Ò¡A½Ð°õ¦æ¥H¤U¨BÆJ¡G

  1. «Ø¥ß SWF ÀÉ®×¥H¤Î HTML ÀɮסC­º¥ý¡A«ö·Ó¦b Flash Professional °õ¦æ ActionScript 3.0 ½d¨Ò©Î¦b Flash Builder °õ¦æ ActionScript 3.0 ½d¨Ò¤¤ªº«ü¥Ü°õ¦æ¡C ¦b Flash Professional ¤¤¡A¿ï¨ú¡u±±¨î > ´ú¸Õ¼v¤ù¡v¡A¥u«Ø¥ß SWF ÀɮסC­Y­n«Ø¥ß³o¨â­ÓÀɮסA½Ð¥ý¦b¡uµo§G³]©w¡v¹ï¸Ü¤è¶ôªº¡u®æ¦¡¡v¯Á¤Þ¼ÐÅÒ¤¤¿ï¨ú¡uFlash¡v©M¡uHTML¡v¡CµM«á¡A¿ï¨ú¡uÀÉ®× > µo§G¡v¡A«Ø¥ß HTML ©M SWF ÀɮפGªÌ¡C¦b Flash Builder ¤¤¡A·í±z°õ¦æ¡B°£¿ù©Î«Ø¥ß¦Û¤vªº Flash Builder ±M®×®É¡A´N¥i¥H¦P®É«Ø¥ß SWF ÀɮשM HTML ÀɮסC

  2. ±N SWF ÀɮשM HTML Àɮ׽ƻs¨ìºô¯¸¦øªA¾¹ªº¥Ø¿ý¡C

  3. ¦b¦æ°Ê¸Ë¸mªºÂsÄý¾¹¦ì§}¦C¡A¿é¤J HTML Àɮתº HTTP ºô§}¡C¨Ò¦p¡A¿é¤J http://www.myWebServer/examples/myExample.html¡C

¦b¦æ°Ê¸Ë¸m¤W°õ¦æ½d¨Ò¤§«e¡A½Ð¦Ò¼{¥H¤U¨C¤@­Ó°ÝÃD¡C

»R¥x¤j¤p

¦b¦æ°Ê¸Ë¸m¤W°õ¦æ½d¨Ò®É¡A±z¨Ï¥Îªº»R¥x¤j¤p·|¤ñ±z¨Ï¥Î«D¦æ°Ê¸Ë¸m®É­n¤p¤@¨Ç¡C«Ü¦h½d¨Ò¤£»Ý­n¯S®íªº¡u»R¥x¡v¤j¤p¡C«Ø¥ß SWF Àɮ׮ɡA½Ð«ü©w¸Ë¸m¾A¦Xªº¡u»R¥x¡v¤j¤p¡C¨Ò¦p¡A«ü©w 176 x 208 ­Ó¹³¯À¡C

¦b¡mActionScript 3.0 ¶}µo¤H­û«ü«n¡n¤¤¡A¹ê»Ú½d¨Òªº¥Î³~¬O»¡©ú¤£¦Pªº ActionScript 3.0 ·§©À©MÃþ§O¡C¥L­Ìªº¨Ï¥ÎªÌ¤¶­±³]­p´N¬O­n¦b®à¤W«¬¹q¸£©Îµ§°O«¬¹q¸£¤W¬Ý¨Ó¬üÆ[¤S¦n¥Î¡CÁöµM¡A³o¨Ç½d¨Ò¥i¥H¦b¦æ°Ê¸Ë¸m¤W°õ¦æ¡A¤£¹L¡u»R¥x¡v¤j¤p©M¨Ï¥ÎªÌ¤¶­±³]­p¨Ã¤£¾A¦X«Ü¤pªº¿Ã¹õ¡CAdobe «Øij±z¦b¹q¸£¤W°õ¦æ¹ê»Úªº½d¨Ò¡A¹ï ActionScript ¦³¤F¬Û·íªºÁA¸Ñ¤§«á¡A¦A¨ì¦æ°ÊÀ³¥Îµ{¦¡¤¤¨Ï¥Î¯S©wªºµ{¦¡½X¤ù¬q¡C

¥H¤å¦rÄæ¦ì¨ú¥N trace ³¯­z¦¡

¦b¦æ°Ê¸Ë¸m¤W°õ¦æ½d¨Ò®É¡A±z¤£·|¬Ý¨ì½d¨Ò¤¤ªº trace ³¯­z¦¡¿é¥X¡C­Y­nÁA¸Ñ¿é¥X¡A½Ð«Ø¥ß TextField Ãþ§Oªº¹êÅé¡CµM«á¡C±N trace ³¯­z¦¡ªº¤å¦rªþ¥[¦Ü¤å¦rÄæ¦ìªº text ÄÝ©Ê¡C

±z¥i¥H¨Ï¥Î¥H¤Uªº¨ç¼Æ¡A³]©w¤@­Ó¤å¦rÄæ¦ì¡A¥H«K¥Î©ó°lÂÜ¡G

function createTracingTextField(x:Number, y:Number, 
                                width:Number, height:Number):TextField { 
           
    var tracingTF:TextField = new TextField(); 
    tracingTF.x = x; 
    tracingTF.y = y; 
    tracingTF.width = width; 
    tracingTF.height = height; 
     
    // A border lets you more easily see the area the text field covers. 
    tracingTF.border = true; 
    // Left justifying means that the right side of the text field is automatically 
    // resized if a line of text is wider than the width of the text field. 
    // The bottom is also automatically resized if the number of lines of text 
    // exceed the length of the text field. 
    tracingTF.autoSize = TextFieldAutoSize.LEFT; 
     
    // Use a text size that works well on the device. 
    var myFormat:TextFormat = new TextFormat(); 
    myFormat.size = 18; 
    tracingTF.defaultTextFormat = myFormat; 
     
    addChild(tracingTF); 
    return tracingTF; 
}

¨Ò¦p¡A±N¦¹¨ç¼Æ·s¼W¦Ü¤å¥óÃþ§O¡A§@¬°¤@­Ó¨p¦³ªº¨ç¼Æ¡C µM«á¡A¦b¤å¥óªº¨ä¥L¤èªk¤¤¡A¨Ï¥ÎÃþ¦ü¤U¦Cªºµ{¦¡½X¨Ó°lÂܸê®Æ¡G

var traceField:TextField = createTracingTextField(10, 10, 150, 150); 
// Use the newline character "\n" to force the text to the next line. 
traceField.appendText("data to trace\n"); 
traceField.appendText("more data to trace\n"); 
// Use the following line to clear the text field. 
traceField.appendText("");

appendText() ¤èªk¥u±µ¨ü¤@­Ó­È·í§@¬O°Ñ¼Æ¡C³o­Ó­È¬O¦r¦ê (¦r¦ê¹êÅé©Î¦r¦ê±`­È)¡C­Y­n¦C¦L«D¦r¦êÅܼƪº­È¡A½Ð¥ý±N¸Ó­ÈÂà´«¬° String¡C³Ì²³æªºÂà´«¤è¦¡´N¬O©I¥sª«¥óªº toString() ¤èªk¡G

var albumYear:int = 1999; 
traceField.appendText("albumYear = "); 
traceField.appendText(albumYear.toString());

¤å¦r¤j¤p

«Ü¦h½d¨Ò¨Ï¥Î¤å¦rÄæ¦ì¡A¨ó§U»¡©ú·§©À¡C¦³®É­Ô¡A½Õ¾ã¤å¦rÄæ¦ì¤¤ªº¤å¦r¤j¤p¡A¥i¥HÅý¨Ï¥ÎªÌ§ó®e©ö¬Ý²M·¡¦æ°Ê¸Ë¸mªº¸ê®Æ¡C¨Ò¦p¡A¦pªG½d¨Ò¨Ï¥Î myTextField ³o­Ó¤å¦rÄæ¦ì¹êÅé¡A½Ð¨Ï¥Î¥H¤Uµ{¦¡½XÅܧó¨ä¤å¦r¤j¤p¡G

// Use a text size that works well on the device. 
var myFormat:TextFormat = new TextFormat( ); 
myFormat.size = 18; 
myTextField.defaultTextFormat = myFormat

Â^¨ú¨Ï¥ÎªÌ¿é¤J

¦æ°Ê§@·~¨t²Î©MÂsÄý¾¹·|®·®» SWF ¤º®e¤£·|±µ¦¬ªº³¡¤À¨Ï¥ÎªÌ¿é¤J¨Æ¥ó¡C¯S©w¦æ¬°·|µø§@·~¨t²Î©MÂsÄý¾¹¦Ó©w¡A¦ý¬O·í±z¦b¦æ°Ê¸Ë¸m°õ¦æ½d¨Ò®É¡A¥i¯à·|³y¦¨µLªk¹w´Áªº¦æ¬°¡C¦p»Ý¸Ô²Ó¸ê°T¡A½Ð°Ñ¾\ KeyboardEvent Àu¥ý¶¶§Ç¡C

¦Ó¥B¡A«Ü¦h½d¨Òªº¨Ï¥ÎªÌ¤¶­±«h¬O°w¹ï®à¤W«¬¹q¸£©Mµ§°O«¬¹q¸£¦Ó³]­p¡C¨Ò¦p¡A¡mActionScript 3.0 ¶}µo¤H­û«ü«n¡n¤¤¡A¤j³¡¤Àªº¹ê»Ú½d¨Ò«D±`¾A¦X¦b®à¤W«¬¹q¸£À˵ø¡C¦]¦¹¡A¦b¦æ°Ê¸Ë¸m¿Ã¹õ¤W¡A¦³®É­Ô¬Ý¤£¨ì§¹¾ãªº»R¥x¡CÂsÄý¾¹¤º®eªº¥­²¾¯à¤OµøÂsÄý¾¹¦Ó©w¡C¦AªÌ¡A³o¨Ç½d¨Òªº¥ª¥k²¾°Ê¬O°w¹ï®·®»¥H¤Î³B²z±²°Ê©Î¥ª¥k¥­²¾¨Æ¥ó¦Ó³]­p¡C¦]¦¹¡A³¡¤À½d¨Òªº¨Ï¥ÎªÌ¤¶­±¨Ã¤£¾A·|¦b¸û¤pªº¿Ã¹õ°õ¦æ¡CAdobe «Øij±z¦b¹q¸£¤W°õ¦æ³o¨Ç½d¨Ò¡A¹ï ActionScript ¦³¤F¬Û·íªºÁA¸Ñ¤§«á¡A¦A¨ì¦æ°ÊÀ³¥Îµ{¦¡¤¤¨Ï¥Î¯S©wªºµ{¦¡½X¤ù¬q¡C

¦p»Ý¸Ô²Ó¸ê°T¡A½Ð°Ñ¾\¥ª¥k²¾°Ê©M±²°ÊÅã¥Üª«¥ó¡C

³B²zµJÂI

³¡¤À½d¨Ò»Ý­n±z´£¨ÑµJÂIµ¹Äæ¦ì¡C ´£¨ÑµJÂIµ¹Äæ¦ì«á¡A±z´N¥i¥H¿é¤J¤å¦r©Î¿ï¨ú«ö¶s¡C­Y­n´£¨ÑÄæ¦ìµJÂI¡A½Ð¨Ï¥Î¦æ°Ê¸Ë¸mªº«ü¼Ð¸Ë¸m¡A¨Ò¦pIJ±±µ§©Î±zªº¤â«ü¡C©ÎªÌ¡A¨Ï¥Î¦æ°Ê¸Ë¸mªº¾ÉÄýÁä¡A´£¨ÑÄæ¦ìµJÂI¡C ­Y­n¿ï¨úµJÂI©Ò¦bªº«ö¶s¡A½Ð¨Ï¥Î¦æ°Ê¸Ë¸mªº¡u¿ï¨ú¡vÁä¡A´N¹³¬O¨Ï¥Î¹q¸£¤Wªº Enter ¤@¼Ë¡C¦b³¡¤À¸Ë¸m¤W¡A»´ÂI«ö¶s¨â¤U´N¥i¥H¿ï¨ú¥¦¡C

¦p»Ý¦³ÃöµJÂIªº¸Ô²Ó¸ê°T¡A½Ð°Ñ¾\ºÞ²zµJÂI¡C

³B²z·Æ¹«¨Æ¥ó

«Ü¦h½d¨Ò·|°»Å¥·Æ¹«¨Æ¥ó¡C¦b¹q¸£¤W¡A¨Ò¦p·í¨Ï¥ÎªÌ¨Ï¥Î·Æ¹«¦bÅã¥Üª«¥ó¤Wºu°Ê¡A©ÎªÌ¦bÅã¥Üª«¥ó¤W«ö¤@¤U·Æ¹««öÁä«á¡A´N·|µo¥Í³o¨Ç·Æ¹«¨Æ¥ó¡C¦b¦æ°Ê¸Ë¸m¤W¡AIJ±±µ§©Î¤â«ü¤§Ãþªº«ü¼Ð¸Ë¸m©Ò²£¥Íªº¨Æ¥ó¡AºÙ¬°Ä²±±¨Æ¥ó¡CFlash Player 10.1 ·|±NIJ±±¨Æ¥ó¹ïÀ³¦Ü·Æ¹«¨Æ¥ó¡C³oºØ¹ïÀ³Ãö«Y¥i¥H½T«O¥ý¶}µo SWF ¤º®e¡A¦AÄ~Äò Flash Player 10.1 ªº¤u§@¡C¦]¦¹¡A¨Ï¥Î«ü¼Ð¸Ë¸m¨Ó¿ï¨ú©Î©ì¦²Åã¥Üª«¥ó®É¡A³o¨Ç½d¨Ò¤´¦³®Ä¡C

®Ä¯à

¦æ°Ê¸Ë¸mªº³B²z¯à¤O¤ñ®à¤W«¬¸Ë¸m®t¡C³¡¤À®ø¯Ó¤j¶q CPU ªº½d¨Ò¦b¦æ°Ê¸Ë¸m¤Wªº°õ¦æ³t«×«ÜºC¡C¨Ò¦p¡Aø»s API ½d¨Ò¡Gºtºâªkµøı²£¥Í¾¹¦b¶i¤J¨C¤@­Ó¼v®æ®É¡A·|¶i¦æ¤j¶q­pºâ©Mø¹Ï¡C ¦b¹q¸£¤W°õ¦æ¦¹½d¨Ò·|»¡©ú¦UºØªºÃ¸¹Ï API¡C¤£¹L¡A¥Ñ©ó®Ä¯à¦³­­¡A©Ò¥H¦¹½d¨Ò¤£¾A¦X³¡¤Àªº¦æ°Ê¸Ë¸m¡C

¦p»Ý¦æ°Ê¸Ë¸m®Ä¯àªº¸Ô²Ó¸ê°T¡A½Ð°Ñ¾\³Ì¨Î¤Æ Flash ¥­¥xªº®Ä¯à¡C

³Ì¨Î§@ªk

¬°¦æ°Ê¸Ë¸m¶}µoÀ³¥Îµ{¦¡®É¡A½d¨Ò¨Ã¤£·|±N³Ì¨Î§@ªk¯Ç¤J¦Ò¶q¡C¦æ°Ê¸Ë¸mªº°O¾ÐÅé»P³B²z¯à¤O¦³­­¡A³o¤@ÂI­n¯S§Oª`·N¡C¦P¼Ë¦a¡A¤p«¬¿Ã¹õªº¨Ï¥ÎªÌ¤¶­±»P®à¤W«¬¹q¸£Åã¥Ü¾¹¦U¦³¤£¦Pªº»Ý¨D¡C¦p»Ý¶}µo¦æ°Ê¸Ë¸mÀ³¥Îµ{¦¡ªº¸Ô²Ó¸ê°T¡A½Ð°Ñ¾\³Ì¨Î¤Æ Flash ¥­¥xªº®Ä¯à¡C

 



¥»½Òµ{¨Ï¥Î Adobe Flash CS5 (§Y Flash 11), Ãö©ó Flash ¦Uª©¥»¥D­n®t²§½ÐÂI¬Ý¥H¤Uºô§}:
  http://en.wikipedia.org/wiki/Adobe_Flash_Professional(¶}·sµ¡)
­PÁÂ:
     ·PÁ¤ý¥Ã±d¥D¥ô+¯À­s¦Ñ®v+¤p©ú¦Ñ®v¼ö±¡ÃÙ§Uªº±Ð§÷¸ê®Æ !

¤W½Ò¦aÂI ¤W½Ò®É¶¡ ºî421 301 ºî421 302 ºî421 303 ½Ðª`·N: ¾Ç®Õ³W©w¥²¶·ÂI¦W! 8:29¤§«á¤~¨ì°OÃm½Ò1¤p®É; 9:29¤§«á¤~¨ì°OÃm½Ò2¤p®É; 10:29¤§«á¤~¨ì°OÃm½Ò3¤p®É
½Ò ¸¹ / ¯Z §O 40184438 / E ¿ï­× 3 ¾Ç¤À ¬ì¥Ø¤¤¤å¦WºÙ 2D ¤¬°Ê³]­p ¬ì¥Ø­^¤å¦WºÙ 2D Interactive Programming ¨C¶g±Â½Ò®É¼Æ 3 ¤p®É ¿ï­× «Øij¥ý
§ì¦^³o godSnippets.xml ¨Ã±q§Aªº°Ê§@­±ªO¶×¤J³oµ{¦¡½X¤ù¬q(·Æ¹««ö¥kÁä¥t¦s·sÀÉ)

 Top