Webéçºã®äžçã¯åžžã«é²åããŠãããã¢ãã¡ãŒã·ã§ã³ããã¢ããªã±ãŒã·ã§ã³éçºãŸã§å€å²ã«ããã課é¡ãæ±ããŠããŸãããã®è§£æ±ºçã®äžã€ãšããŠç»å Žããã®ãActionscriptã§ããããããã©ã®ãããªèšèªãªã®ããããžãã¹ããŒãœã³ã«ã¯ç解ãã«ããåŽé¢ããããŸãããã®çæé解説ã§ã¯ãActionscriptã®åºæ¬ãããã®å¿çšãŸã§ãæŽå²ãäž»ãªçšéãJavaScriptãšã®æ¯èŒãçŸç¶ãšå°æ¥æ§ãã¯ãããææ³ã®çŽ¹ä»ãéçºç°å¢ã®ã»ããã¢ããããªããžã§ã¯ãæåããã°ã©ãã³ã°ãã¢ãã¡ãŒã·ã§ã³ãã€ã³ã¿ã©ã¯ãã£ãã³ã³ãã³ãã®äœæããããŠäŸ¿å©ãªããã°ã©ãã³ã°TipsãŸã§ãåããããã説æããŸããããããActionscriptãåŠã³ããã䜿çšããŠããããžãã¹ããŒãœã³ã®çããã«ããã®èšäºãå®è·µçãªç¥èãšã€ã³ã¹ãã¬ãŒã·ã§ã³ãäžããããšã§ãããã
1. Actionscriptãšã¯äœãïŒ
Actionscriptãšã¯ãAdobe Flashãã©ãããã©ãŒã ã§äœ¿çšãããã¹ã¯ãªããã£ã³ã°èšèªã§ãããŠãŒã¶ãŒãã€ã³ã¿ã©ã¯ãã£ããªWebã¢ããªã±ãŒã·ã§ã³ãã²ãŒã ãã¢ãã¡ãŒã·ã§ã³ãªã©ãäœæããããã«éçºãããè±å¯ãªæ©èœæ§ãšæ¡åŒµæ§ãåããŠããŸããé¡äŒŒã®Webæè¡ãšæ¯èŒããŠãFlashãšçµã¿åãããããšã«ãã£ãŠãã°ã©ãã£ãã¯ã¹ã®è¡šçŸåãå€§å¹ ã«åäžããã®ãç¹åŸŽã§ãã
ãã®ã¹ã¯ãªããã£ã³ã°èšèªã¯ãªããžã§ã¯ãæåçãªã¢ãããŒããæ¡çšããŠãããå¹ççãªã³ãŒãã®åå©çšãå¯èœã§ããæ©èœã®ã«ã¹ã¿ãã€ãºãèªååãä¿é²ããããã«ãã¶ã€ã³ãããŠãããããçšåºŠã®é«ãåããã€ã³ã¿ã©ã¯ã·ã§ã³ãèŠæ±ããããããžã§ã¯ãã«ãããŠåãçºæ®ããŸãã
ãŸããActionscriptã¯ã€ãã³ãããªãã³ã®ããã°ã©ãã³ã°èšèªã§ãããç¹å®ã®ã¢ã¯ã·ã§ã³ãããªã¬ãŒããããšãã«ã³ãŒããå®è¡ãããããèšèšãããŠããŸããããã«ãããã¯ãªãšã€ã¿ãŒã¯ãŠãŒã¶ãŒã®æäœã«å¿ããŠãã€ãããã¯ãªäœéšãæäŸããç¬èªã®ã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ã§ããŸãã
1.1 Actionscriptã®æŽå²
Actionscriptã®èµ·æºã¯1990幎代åŸåã«ãŸã§ããã®ãŒããŸããMacromedia瀟ã«ãã£ãŠFlash 4ãšå ±ã«åããŠå°å ¥ãããåŸãAdobe瀟ã«ããMacromediaã®è²·åãšå ±ã«ããã®éçºã¯Adobeã«åŒãç¶ãããŸãããåæã®ããŒãžã§ã³ããæ©èœæ§ãå€§å¹ ã«åäžããçæãããã¢ãã¡ãŒã·ã§ã³ãã¢ããªã±ãŒã·ã§ã³ã¯ããæŽç·ŽãããŸããã
ç¹ã«Actionscript 3.0ã®ç»å Žã¯ãããã©ãŒãã³ã¹ã®åŒ·åãšããã°ã©ãã³ã°ã®æšæºåã«å€§ããè²¢ç®ããŸããããã匷åãªAPIã®ãµããŒããšãšãã«ãåçãªãªã³ã©ã€ã³äœéšã®æ°ããªå¯èœæ§ãæããå€ãã®Webéçºè ã«æ¡çšããããã£ãããšãªããŸããã
ããããã¢ãã€ã«ããã€ã¹ã®å°é ãšHTML5ãªã©ã®ç«¶åæè¡ã®é²æ©ã«ãããActionscriptããã³Flashæè¡ã®éèŠæ§ã¯æ¬¡ç¬¬ã«äœäžãAdobeã¯æçµçã«Flashãã©ãããã©ãŒã ã®ãµããŒããçµäºããããšãçºè¡šããŸããã
1.2 Actionscriptã®äž»ãªçšé
Actionscriptãé »ç¹ã«äœ¿çšãããåéã®äžã€ã¯ãã€ã³ã¿ã©ã¯ãã£ããªWebã²ãŒã ã®éçºã§ããç°¡åãªãã©ãŠã¶ã²ãŒã ããè€éãªãã«ããã¬ã€ã€ãŒã²ãŒã ãŸã§ãActionscriptã¯ãã®åŒ·åãªã°ã©ãã£ãã¯ãã³ããªã³ã°ãšé«éãªå®è¡é床ã®ãããã§éžã°ããŠããŸããã
ãŸãããªã³ã©ã€ã³åºåãWebãµã€ãã®ã€ã³ã¿ã©ã¯ãã£ããªã¢ãã¡ãŒã·ã§ã³ãå¶äœããéã«ãActionscriptã圹ç«ãŠãããŠããŸãããŠãŒã¶ãŒã®æ³šç®ãåŒããã¡ãã»ãŒãžãäŒããããã®é åçãªããžã¥ã¢ã«ãšãã§ã¯ããçã¿åºãããšãå¯èœã§ããã
æè²ãäŒæ¥ç ä¿®ã®åéã«ãããŠããææããã¬ãŒã³ããŒã·ã§ã³ã®åŒ·åãç®çãšããŠãActionscriptãçµã¿èŸŒãŸããã€ã³ã¿ã©ã¯ãã£ããªã³ã³ãã³ãã®å¶äœã«å©çšãããŠããŸããããŠãŒã¶ãŒã®é¢äžãæ·±ããåŠç¿äœéšãè±ããªãã®ã«å€ããèœåãæã£ãŠããŸãã
1.3 ActionscriptãšJavaScriptã®æ¯èŒ
ActionscriptãšJavaScriptã¯äž¡è ãšãã«ECMAScriptãšããæšæºä»æ§ã«åºã¥ããŠãããææ³ã®é¢ã§å€ãã®é¡äŒŒç¹ãæã£ãŠããŸãããããã䜿çšããããã©ãããã©ãŒã ãå®è¡ç°å¢ãç°ãªããããããããã®èšèªã¯ç¬èªã®ç¹åŸŽãçºæ®ããŸãã
JavaScriptã¯Webãã©ãŠã¶ã®äžã§å®è¡ãããäž»ã«WebããŒãžäžã®åçãªèŠçŽ ãã€ã³ã¿ã©ã¯ãã£ããªæ©èœãå¶åŸ¡ããããã«äœ¿ãããŠããŸããäžæ¹ã§ãActionscriptã¯Adobe Flashãã¬ã€ã€ãŒç°å¢å ã§åäœããå€åœ©ãªã¡ãã£ã¢ã³ã³ãã³ããè€éãªã¢ãã¡ãŒã·ã§ã³ãå¯èœã«ããããã«éçºãããŸããã
è¿å¹Žã§ã¯ãHTML5ãJavaScriptãCSS3ãªã©ã®æè¡ãé²åããåŸæ¥FlashãšActionscriptã§æäŸãããŠãããããªäœéšããã©ãŠã¶äžã§çŽæ¥å®çŸããããšãå¯èœã«ãªã£ãŠããŸããããã«ãããJavaScriptã®éèŠæ§ã¯å¢ãäžæ¹ã§ãActionscriptã®äœ¿åœã¯åŸã ã«æžå°ããŠãããŸããã
1.4 Actionscriptã®çŸç¶ãšå°æ¥æ§
Actionscriptã®äººæ°ãšäœ¿çšåºŠã¯ãæéãšãšãã«æžå°ããŠããŸããAdobe Flashã®ãµããŒãçµäºã倧ããªèŠå ãšãªã£ãŠãããå€ãã®éçºè ãäŒæ¥ãHTML5ãJavaScriptãWebGLãªã©ä»ã®æè¡ãžãšç§»è¡ããŠããŸãã
ãã®ãããçŸåšActionscriptãåŠã¶ããšã¯äžè¬çãªãã©ã¯ãã£ã¹ã§ã¯ãªããæ¢åã®FlashããŒã¹ã®ãããžã§ã¯ããã¡ã³ããã³ã¹ãããªã©ç¹å®ã®ããŒãºã«å¿ããŠå¿ èŠãšãããããšãããçšåºŠã§ããæ°èŠãããžã§ã¯ãã§FlashãActionscriptãæ¡çšããã±ãŒã¹ã¯ã»ãŒèŠãããªããªããŸããã
ããã¯èšã£ãŠããActionscriptã®æŠå¿µãããã°ã©ãã³ã°ã®çµéšã¯ãä»ã®èšèªãåŠã¶éã®è¯å¥œãªåºç€ãšãªãããšããããŸãããªããžã§ã¯ãæåããã°ã©ãã³ã°ã®ç解ãã€ãã³ãããŒã¹ã®ããã°ã©ãã³ã°ã¹ãã«ã¯ãä»æ¥ã®å€ãã®ããã°ã©ãã³ã°èšèªããã¬ãŒã ã¯ãŒã¯ã§ãå¿çšããããããå®å šã«ç¡é§ã«ã¯ãªããŸããã
2. åºæ¬çãªActionscriptã®ææ³
Actionscriptã¯Adobe Flashãã©ãããã©ãŒã ã®ããã®ããã°ã©ãã³ã°èšèªã§ãããã®èšäºã§ã¯çæéã§Actionscriptã®åºç€ãææ¡ããããã®æ å ±ãæäŸããŸãããŠã§ãéçºè ãã¢ãã¡ãŒã·ã§ã³å¶äœè ãªã©ãå€å²ã«ãããåéã®å°é家ãå©çšããActionscriptã¯ãè¿ éã§å¹æçãªã³ã³ãã³ãå¶äœãå¯èœã«ããŸãã
以äžã«ãActionscriptã®åºæ¬çãªææ³ã®æŠèŠãç°¡æœã«èª¬æããŸããã³ãŒãã®æžãå§ãããæé©åæè¡ã«è³ããŸã§ã®ç¥èãæäœéæããŠããããšãéèŠã§ãã
ååŠè ããäžçŽè ã«é²ãããã®ã«ã®ãšãªãããã€ãã®ã³ã³ã»ãããæãäžããŠãããŸãããã
2.1 å€æ°ã®å®£èšãšããŒã¿å
Actionscriptã«ãããŠå€æ°ã¯ãããŒã¿ãæ ŒçŽããããã®åºæ¬çãªèŠçŽ ã§ããå€æ°ã¯varããŒã¯ãŒãã䜿çšããŠå®£èšãããŸããäŸãã°ãvar myVariable:String;
ã¯æåååã®å€æ°myVariableã宣èšããŸãã
ããŒã¿åã«ã¯ãStringãNumberãBooleanãArrayãªã©ããããããããç°ãªãçš®é¡ã®ããŒã¿ãä¿æããŸããåå®å šãä¿ã¡ããšã©ãŒãæžããããã«ã¯ãé©åãªããŒã¿åãçšããããšã倧åã§ãã
å€æ°ã®å€ã¯å®£èšåŸãã€ã§ãæŽæ°ããããšãã§ããmyVariable = "Hello, World!";
ã®ããã«ããŠæ°ããå€ã代å
¥ããããšãå¯èœã§ãã
2.2 é¢æ°ã®äœæãšäœ¿çšæ¹æ³
é¢æ°ã¯åå©çšå¯èœãªã³ãŒããããã¯ã§ãããç¹å®ã®ã¿ã¹ã¯ãå®è¡ããŸããActionscriptã§ã¯function
ããŒã¯ãŒãã䜿ã£ãŠé¢æ°ãå®çŸ©ããŸããäŸãšããŠãfunction greet(name:String) :void { alert("Hello, " + name); }
ã¯ãæšæ¶ãè¡ãç°¡åãªé¢æ°ã§ãã
é¢æ°å ã§åŒæ°ãåããå¿ èŠã«å¿ããŠå€ãè¿ãããšãã§ããŸãããã®äŸã§ã¯ãæž¡ãããååã䜿çšããŠãŠãŒã¶ãŒã«æšæ¶ããããšã§ãã€ã³ã¿ã©ã¯ãã£ããªäœéšãäœæããŠããŸãã
é¢æ°ã¯ã³ãŒãã®åå©çšæ§ãé«ããããæ§é åãããããã°ã©ã ãäœæããåºç€ãšãªããŸãããã䜿ãããã³ãŒããé¢æ°ã«ãŸãšããããšã§ãããã°ã©ã å šäœã®å¯èªæ§ãšã¡ã³ããã³ã¹æ§ãåäžããŸãã
2.3 æ¡ä»¶æãšã«ãŒã
æ¡ä»¶æã¯Actionscriptã§éåžžã«éèŠãªåœ¹å²ãæãããŸããifãswitchãšãã£ãããŒã¯ãŒãã䜿ã£ãŠãã³ãŒãã®å®è¡ãå¶åŸ¡ããŸããäŸãã°ãif (score > 50) { passTest(); }
ã¯ãã¹ã³ã¢ã50ãè¶
ããå Žåã«ã®ã¿passTesté¢æ°ãåŒã³åºããŸãã
ã«ãŒãã¯ãäžå®ã®æ¡ä»¶äžã§ã³ãŒããããã¯ãäœåºŠãå®è¡ãããããã®æ§æã§ããforãwhileãšãã£ãããŒã¯ãŒãã䜿çšãããŸããäŸãšããŠãfor (var i:int = 0; i < 10; i++) { trace(i); }
ã¯ã0ãã9ãŸã§ã®æ°åãåºåããŸãã
ææ·ãªéçºã«ãããŠãæ¡ä»¶æãšã«ãŒãã®ç解ãšé©åãªäœ¿çšã¯ã³ãŒãã®å¹çãšå¹ææ§ãé«ããäžã§äžå¯æ¬ ã§ããè€æ°ã®ã·ããªãªãç¶²çŸ ããå¿ èŠã«å¿ããŠå埩åŠçãè¡ããèœåã¯ãå šãŠã®Actionscriptéçºè ã身ã«ã€ããã¹ãã¹ãã«ã§ãã
2.4 ã€ãã³ããã³ããªã³ã°ã®åºç€
ã€ãã³ããã³ããªã³ã°ã¯ãå©çšè
ã®ã¢ã¯ã·ã§ã³ãã·ã¹ãã çæã®ã€ãã³ãã«å¿ããããã°ã©ã ã®åå¿ãæ±ããŸããActionscriptã§ã¯addEventListener()
ã¡ãœãããçšããŠãã€ãã³ããªã¹ããŒããªããžã§ã¯ãã«ç»é²ããŸãã
äŸãã°ãbutton.addEventListener(MouseEvent.CLICK, clickHandler);
ãšèšè¿°ããããšã§ããã¿ã³ãã¯ãªãã¯ããéã«ç¹å®ã®é¢æ°ïŒãã®å Žåã¯clickHandlerïŒãåŒã³åºãããããã«ãªããŸãããã®æè»æ§ããFlashã®ã€ã³ã¿ã©ã¯ãã£ããªç¹æ§ã匷åããŠããŸãã
æ£ç¢ºãªã€ãã³ããã³ããªã³ã°ã¯ããŠãŒã¶ãŒã®æåŸ ã«æ²¿ã£ããã¹ã ãŒãºã§çŽæçãªUIãèšèšããããã«ã¯æ¬ ãããŸãããã€ãã³ããªã¹ããŒã®ç®¡çãšã¡ã¢ãªãŒããã®é©åãªè§£æŸã¯ãããã©ãŒãã³ã¹ãæ倧éã«åŒãåºãããã®éµã§ãã
3. Actionscriptéçºç°å¢ã®ã»ããã¢ãã
3.1 å¿ èŠãªããŒã«ãšãã¬ãŒã ã¯ãŒã¯
éçºãéå§ããåã«ãActionscriptéçºã§å¿ é ãšãªãããã€ãã®ããŒã«ããããŸããAdobe Animate CCïŒä»¥åã®Adobe FlashïŒã¯ãActionscriptã䜿ã£ãŠã¢ãã¡ãŒã·ã§ã³ãã€ã³ã¿ã©ã¯ãã£ããªã³ã³ãã³ããéçºããäž»èŠãªããŒã«ã§ãããŸããApache Flex SDKãActionscriptã¢ããªã±ãŒã·ã§ã³ã®éçºã«åºã䜿çšããããã¬ãŒã ã¯ãŒã¯ã§ãããããã®ããŒã«ã«å ããFlash BuilderãFlash Developãªã©ã®çµ±åéçºç°å¢(IDE)ãå©çšè ã«ãšã£ãŠéèŠã§ãã
ãããã®ããŒã«ãæããããšã§ãéçºè ã¯ã³ãŒãã®èšè¿°ãã³ã³ãã€ã«ããã¹ããäžå çã«è¡ããããã«ãªããŸããåããŒã«ã¯ããŠãŒã¶ãŒã¬ã€ãããªã³ã©ã€ã³ãªãœãŒã¹ãéããŠåŠç¿å¯èœã§ãããActionscriptéçºã®åºç€ããå¿çšãŸã§å¹ åºãã«ããŒããŸãã
ãŸããã©ã€ãã©ãªããã©ã°ã€ã³ã掻çšããããšã§éçºå¹çãé«ãããããã¿ã€ãã³ã°ã®ã¹ããŒããäžããããšãã§ããŸããããã«ãããéçºã®åæ段éã«ãããŠã¯ãããã¹ã ãŒãºã«éçºäœæ¥ãé²ããããšãå¯èœã§ãã
3.2 éçºç°å¢ã®æ§ç¯æé
éçºç°å¢ã®æ§ç¯ã«ã¯éèŠãªæé ããããŸãããŸããAdobe Animate CCã®ææ°çãã€ã³ã¹ããŒã«ããããšããå§ããŸããããã¯Adobe Creative CloudãéããŠååŸã§ããŸãã次ã«ãFlex SDKã®ããŠã³ããŒããšèšå®ãè¡ãå¿ èŠããããããã«ã¯Apacheã®å ¬åŒãŠã§ãããŒãžããSDKãããŠã³ããŒãããé©åãªãã£ã¬ã¯ããªã«å±éããäœæ¥ãå«ã¿ãŸãã
IDEã®èšå®ã¯ããã«ã«ã¹ã¿ãã€ãºãå¯èœã§ããããšãã°ãFlash Builderã䜿çšããéã«ã¯ããã«ããã¹ã®æ§æãå€éšã©ã€ãã©ãªã®ãªã³ã¯ãšãã£ããç°å¢èšå®ã«æãå ããããšãã§ããŸããããã«ãããéçºããã»ã¹ã®ã«ã¹ã¿ãã€ãºãšæé©åãå³ããŸãã
æçµçã«ã¯ãéçºè ã¯éçºããããããžã§ã¯ãã«å¿ããŠãå¿ èŠãªãã©ã°ã€ã³ãæ¡åŒµæ©èœãè¿œå ããããšã«ãªããŸãããã®ããã«ããŠç¶¿å¯ã«èšç»ãããéçºç°å¢ãæŽããããšã§ãå¹ççãã€å¹æçãªéçºããã»ã¹ã確ç«ãããããšãã§ããŸãã
3.3 ç°¡åãªãããžã§ã¯ãã®äœæ
åºæ¬çãªActionscriptãããžã§ã¯ãã®äœæã¯ãæ°ãããã¡ã€ã«ãäœæããActionscriptãéžæããŠã³ãŒãã£ã³ã°ãéå§ããããšã§è¡ããŸããäŸãã°ãAdobe Animate CCã§æ°ããActionscript 3.0ãããžã§ã¯ããå§ããã«ã¯ãæ°èŠäœæãã€ã¢ãã°ã§ãActionscript 3.0ããªãã·ã§ã³ãéžæããŸãã
ç°¡åãªHello Worldããã°ã©ã ãäœæããããšããå§ãããšè¯ãã§ããããããã¯åºæ¬çãªèšèªã®ææ³ãšã·ã³ã¿ãã¯ã¹ãç解ããã®ã«åœ¹ç«ã¡ãéçºã®åºç€ãåŠã¶ã®ã«é©ããæ¹æ³ã§ãããŸããã¹ããŒãžãã¿ã€ã ã©ã€ã³ãã€ãã³ããªã¹ããŒãªã©ãActionscriptã®åºæ¬çãªãªããžã§ã¯ããšæŠå¿µã«ã€ããŠç解ãæ·±ããããšãã§ããŸãã
ããã«ããããããããžã§ã¯ããéããŠãã¢ãã¡ãŒã·ã§ã³ãã€ã³ã¿ã©ã¯ãã£ãæ§ã®ããèŠçŽ ãå®è£ ããæ¹æ³ãåŠã¶ããšãã§ããŸããåãã®ãã¡ã¯ã·ã³ãã«ãªãããžã§ã¯ããéããŠç·Žç¿ãç©ãããšããå§ãããŸãã
3.4 ãšã©ãŒã®ãããã°æ¹æ³
éçºéçšã«ãããŠé¿ããããªãã®ããšã©ãŒã§ããActionscriptã§ã¯ãããã°äœæ¥ãéåžžã«éèŠãšãªããŸããIDEã«ã¯ãšã©ãŒãç¹å®ããä¿®æ£ã®æå©ããšãªããããã°ããŒã«ãå«ãŸããŠããŸããããšãã°ãFlash Builderã«ã¯è±å¯ãªãããã°ãªãã·ã§ã³ãããããã¬ãŒã¯ãã€ã³ãã®èšå®ãå€æ°ã®ç£èŠãã¹ãããå®è¡ãšãã£ãæ©èœãå©çšã§ããŸãã
ãŸããåºåããã«ã¯ã©ã³ã¿ã€ã ãšã©ãŒããã¬ãŒã¹ã¹ããŒãã¡ã³ãã®åºåã確èªããã®ã«åœ¹ç«ã¡ãŸãããšã©ãŒã¡ãã»ãŒãžã¯åé¡ã®ããã³ãŒãã®äœçœ®æ å ±ãå«ããããå¹ççãªãã©ãã«ã·ã¥ãŒãã£ã³ã°ã«æ¬ ãããŸããã
ãããã°ã®ããã»ã¹ã¯ãè€éãªãã°ã®åå ã究æããéã®å°éãªäœæ¥ã«ãªãããšããããŸãããäžæã掻çšããããšã§éçºãµã€ã¯ã«ãå€§å¹ ã«ççž®ã§ããŸããä¿¡é Œæ§ã®é«ãã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããããã«ã¯ãå¹æçãªãããã°æè¡ã身ã«ã€ããããšãäžå¯æ¬ ã§ãã
4. Actionscriptã§ã®ãªããžã§ã¯ãæåããã°ã©ãã³ã°
Actionscriptã¯ããªããžã§ã¯ãæåã®ã³ã³ã»ãããçšããããã°ã©ãã³ã°èšèªã§ãããã®èšäºã§ã¯ãActionscriptã«ããããªããžã§ã¯ãæåã®äž»èŠãªç¹åŸŽãç°¡æœã«è§£èª¬ããŸããããã§ã¯ãã¯ã©ã¹ãšãªããžã§ã¯ãã®åºç€ããå§ããŠã¿ãŸãããã
4.1 ã¯ã©ã¹ãšãªããžã§ã¯ãã®åºç€
ã¯ã©ã¹ã¯ãªããžã§ã¯ãã®èšèšå³ã§ããActionscriptã«ãããŠã¯ã©ã¹ã¯ãããŒã¿ãšã¡ãœãããäžã€ã«ãŸãšãããã®ã§ãããããã«ãã£ãŠãªããžã§ã¯ãã®æ¯ãèããšç¶æ ãå®çŸ©ãããŸããã¯ã©ã¹ã®å®£èšã¯ããŒã¯ãŒã’class’ã䜿çšããŠè¡ãããŸãã
ãªããžã§ã¯ãã¯ãã®ã¯ã©ã¹ããã€ã³ã¹ã¿ã³ã¹åãããå ·äœçãªäŸã§ããExampleClassã¯ã©ã¹ããæ°ãããªããžã§ã¯ããäœæããã«ã¯ã’new ExampleClass()’ãšããæ§æã䜿çšããŸãããªããžã§ã¯ããä»ããŠãã¯ã©ã¹ã«å®çŸ©ãããããããã£ãã¡ãœããã«ã¢ã¯ã»ã¹ã§ããŸãã
ã¯ã©ã¹ã¯åå©çšå¯èœãªã³ãŒãã®ãšã³ã·ã¹ãã ãæäŸããããŒã¿æ§é ãšé¢é£æ©èœãæ§æããã®ã«åœ¹ç«ã¡ãŸãããã®åå©çšæ§ã«ãããActionscriptéçºè ã¯ããå¹ççã«é«å質ãªã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ã§ããããã«ãªããŸãã
4.2 ç¶æ¿ãšããªã¢ãŒãã£ãºã
ç¶æ¿ã¯ãªããžã§ã¯ãæåã®äžæ žãšãªãæŠå¿µã§ãã¯ã©ã¹ãä»ã®ã¯ã©ã¹ã®ããããã£ãã¡ãœãããåŒãç¶ãããšãå¯èœã«ããŸããããã«ãããå ±éã®æ©èœãæã€è€æ°ã®ã¯ã©ã¹ãç°¡æœã«ç®¡çã§ããŸããActionscriptã§ã¯ã’extends’ããŒã¯ãŒãã䜿çšããŠç¶æ¿ãè¡ãããŸãã
ããªã¢ãŒãã£ãºã ãšã¯ãåãã€ã³ã¿ãŒãã§ã€ã¹ãŸãã¯åºåºã¯ã©ã¹ãå ±æãããªããžã§ã¯ãããç°ãªãæ¯ãèãã瀺ãèœåã®ããšã§ããäŸãã°ãç°ãªããµãã¯ã©ã¹ã®ãªããžã§ã¯ããåãã¡ãœããåã§ç°ãªãã¢ã¯ã·ã§ã³ãå®è¡ããããšãæããããŸãã
ç¶æ¿ãšããªã¢ãŒãã£ãºã ã¯ãã³ãŒãã®ã¢ãžã¥ãŒã«æ§ãšæè»æ§ãåäžãããããã«ãActionscriptã«ãããŠæ¥µããŠéèŠãªåœ¹å²ãæãããŸããããã«ãããçºå±çãã€ãã€ãããã¯ãªã¢ããªã±ãŒã·ã§ã³æ§ç¯ãå¯èœãšãªããŸãã
4.3 ã€ã³ã¿ãŒãã§ã€ã¹ãšæœè±¡å
ã€ã³ã¿ãŒãã§ã€ã¹ã䜿çšãããšãç¹å®ã®ã¡ãœããã»ãããæã€ã¯ã©ã¹ãå®è£ ãã¹ãå¥çŽãå®çŸ©ã§ããŸãããã®å¥çŽãéããŠãç°ãªãã¯ã©ã¹ãå ±éã®æ§é ãæã€ãšããä¿èšŒãåŸãããŸããActionscriptã§ã¯ã’interface’ããŒã¯ãŒããçšããŠã€ã³ã¿ãŒãã§ã€ã¹ã宣èšãããŸãã
æœè±¡åã¯ãã·ã¹ãã ã®è€éãã管çããããã«å©çšãããŸããåºæ¬çãªã¢ã€ãã¢ã¯ãå®è£ ã®è©³çŽ°ãé èœãããŠãŒã¶ãŒã«ã¯å¿ èŠæå°éã®ã€ã³ã¿ãã§ãŒã¹ã ããæäŸããããšã§ããããã«ãããããããã®éšåãç¬ç«ããŠå€æŽããããšãå¯èœã«ãªããããä¿å®æ§ãåäžããŸãã
ã€ã³ã¿ãŒãã§ã€ã¹ãšæœè±¡åã«ãã£ãŠãActionscriptããã°ã©ããŒã¯ã¯ãªãŒã³ã§ç解ããããã³ãŒããçæããç°ãªãã·ã¹ãã ã³ã³ããŒãã³ãéã§ã®ç¢ºå®ãªã€ã³ã¿ã©ã¯ã·ã§ã³ãä¿é²ããããšãã§ããŸãã
4.4 ãšã³ã«ãã»ã¬ãŒã·ã§ã³ãšã¢ã¯ã»ã¹ä¿®é£Ÿå
ãšã³ã«ãã»ã¬ãŒã·ã§ã³ã¯ããªããžã§ã¯ãã®å éšç¶æ ãå€éšããçŽæ¥ã¢ã¯ã»ã¹ããããšãªããç¹å®ã®ã€ã³ã¿ãŒãã§ãŒã¹ãéããŠã®ã¿æäœãããšããååã§ããããã¯ããã°ã©ã ã®å®å šæ§ãé«ããå€éšããäºæãã¬å€æŽããããããšãé²ããŸãã
Actionscriptã§ã¯ãããããã£ãã¡ãœããã®åã«ã¢ã¯ã»ã¹ä¿®é£Ÿåãèšå®ããããšã§ãã¯ã©ã¹å€éšããã®ã¢ã¯ã»ã¹ãå¶åŸ¡ããŸãã’public’ã’private’ã’protected’ãªã©ã䜿çšããããããããç°ãªãã¢ã¯ã»ã¹ã¬ãã«ãæäŸããŸãã
ãšã³ã«ãã»ã¬ãŒã·ã§ã³ãšã¢ã¯ã»ã¹ä¿®é£Ÿåã¯ãã³ãŒãã®æŽçåã³ãã®å®è¡ã«éããŠã®äºæž¬å¯èœæ§ãä¿èšŒããã®ã«åœ¹ç«ã¡ãŸããããã«ãããActionscriptã³ãŒãã®ã»ãã¥ãªãã£ãšå ç¢æ§ã確ä¿ãããã®ã§ãã
5. Actionscriptã«ããã¢ãã¡ãŒã·ã§ã³ãšã€ã³ã¿ã©ã¯ãã£ãã³ã³ãã³ãã®äœæ
Actionscriptã¯Adobe Flashãã©ãããã©ãŒã ã§äœ¿çšãããèšèªã§ãåãã®ããã³ã³ãã³ãã®å¶äœã«éåžžã«åªããŠããŸãããã®èšäºã§ã¯ãActionscriptã䜿ã£ãã¢ãã¡ãŒã·ã§ã³ãšã€ã³ã¿ã©ã¯ãã£ããªã³ã³ãã³ãã®äœãæ¹ã«ã€ããŠãè¿ éãã€ç°¡æœã«èª¬æããŸãã
Actionscriptã䜿ãããšã§ããŠãŒã¶ãŒãé¢äžããé åçãªããžã¿ã«äœéšãäœãäžããããšãã§ããŸããã¿ã€ã ã©ã€ã³ã¢ãã¡ãŒã·ã§ã³ããéå§ããã³ãŒããéããã¢ãã¡ãŒã·ã§ã³ã®å¶åŸ¡ãã€ã³ã¿ã©ã¯ãã£ããªUIã®èšèšãããã«ã¯ã²ãŒã éçºãŸã§ãåºæ¬çãªèŠçŽ ãç¶²çŸ ããŸãã
ãããã®æèœã¯ããã¶ã€ããŒãããã°ã©ããŒãèŠèŠçãªãããžã§ã¯ããããçŽæçã«äœæããããã«åœ¹ç«ã¡ãŸããã§ã¯ãActionscriptã®åºæ¬ããå ¥éããŸãããã
5.1 ã¿ã€ã ã©ã€ã³ã¢ãã¡ãŒã·ã§ã³ã®åºæ¬
ã¿ã€ã ã©ã€ã³ã¢ãã¡ãŒã·ã§ã³ã¯ãFlashã³ã³ãã³ãå¶äœã«ãããŠæãåºæ¬çãªèŠçŽ ã®äžã€ã§ãããã¬ãŒã ã䜿ã£ãŠå³åœ¢ããã£ã©ã¯ã¿ãŒã移åãããããšã§ãã¢ãã¡ãŒã·ã§ã³ãäœæããŸãã
ãã¬ãŒã ãã€ãã¬ãŒã ã§ãªããžã§ã¯ãã®äœçœ®ãå€ããããšã§ãèŠèŠçãªæµããçã¿åºããŸããããã¯ãã¹ã©ã€ãããšã«ç°ãªãã·ãŒã³ã衚瀺ããããšã«ãã£ãŠãã¹ããŒãªãŒããŒãã®ããã«æ©èœããŸãã
ã·ã³ãã«ãã¢ãŒã·ã§ã³ãã¥ã€ãŒã³ã掻çšããããšã§ãããæ»ããã§è€éãªã¢ãã¡ãŒã·ã§ã³ãå¶äœããããšãå¯èœã«ãªããŸããåå¿è ã§ãçŽæçã«æäœã§ããã€ã³ã¿ãŒãã§ãŒã¹ãå©çšããŠãé åçãªã¿ã€ã ã©ã€ã³ã¢ãã¡ãŒã·ã§ã³ãçæéã§å®æãããããšãã§ããŸãã
5.2 ã³ãŒãã«ããã¢ãã¡ãŒã·ã§ã³ã®å¶åŸ¡
ã³ãŒããçšããããšã§ãã¿ã€ã ã©ã€ã³ã¢ãã¡ãŒã·ã§ã³ã«æ¯ã¹ãŠããã«é«åºŠãªã¢ãã¡ãŒã·ã§ã³ãå¶åŸ¡ããããšãã§ããŸããActionscriptã䜿çšããŠãã€ãã³ããã³ãã©ãŒãé¢æ°ãå®çŸ©ããã¢ãã¡ãŒã·ã§ã³ãåçã«æäœããŸãã
äŸãã°ããªããžã§ã¯ãã«ã€ãã³ããªã¹ããŒãè¿œå ããŠããŠãŒã¶ãŒã®ã¢ã¯ã·ã§ã³ïŒã¯ãªãã¯ãããŠã¹ãªãŒããŒïŒã«åºã¥ããŠã¢ãã¡ãŒã·ã§ã³ãããªã¬ãŒããããšãã§ããŸããããã¯ã²ãŒã ãã€ã³ã¿ã©ã¯ãã£ããªãã¬ãŒã³ããŒã·ã§ã³ã«ãããŠç¹ã«æçšã§ãã
å ããŠãã¢ãã¡ãŒã·ã§ã³ã®ã«ãŒããæ¡ä»¶åå²ãç©ççè¡åããšãã¥ã¬ãŒãããããã®æ°åŠçã¢ã«ãŽãªãºã ãªã©ãå©çšããŠããŠãŒã¶ãŒãäºæãã¬åœ¢ã§ã€ã³ã¿ã©ã¯ãã£ãã«äœéšã§ããã³ã³ãã³ããåµãåºãããšãå¯èœã§ãã
5.3 ã€ã³ã¿ã©ã¯ãã£ããªãŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹ã®èšèš
ã¢ãã¡ãŒã·ã§ã³ãšåæ§ã«ãActionscriptã¯ã€ã³ã¿ã©ã¯ãã£ããªãŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹(UI)ã®æ§ç¯ã«ãé©ããŠããŸããã€ã³ã¿ãŒãã§ã€ã¹ã¯ãŠãŒã¶ãŒãã³ã³ãã³ããšã©ã®ããã«å¯Ÿè©±ãããã決å®ããéèŠãªéšåã§ãã
ã«ã¹ã¿ã ã¡ãã¥ãŒããã¿ã³ãã¹ã©ã€ããŒãªã©ã®ã€ã³ã¿ã©ã¯ãã£ãèŠçŽ ãäœæãããããããŠãŒã¶ãŒã®å ¥åã«å¿ããŠåå¿ããããã¹ã¯ãªãããèšè¿°ããŸããã€ã³ã¿ãŒãã§ã€ã¹èŠçŽ ã¯ãã°ãã°ã¢ãã¡ãŒã·ã§ã³ãšçµã¿åãããããããã€ãããã¯ãªãŠãŒã¶ãŒäœéšãæäŸããŸãã
ã³ã³ãã³ãã®ããã²ãŒã·ã§ã³ãä¿é²ãããŠãŒã¶ãŒã®åå ãåŒãåºããããããUIãèšèšããããšã§ãå šäœã®ãŠãŒã¶ãŒãšã³ã²ãŒãžã¡ã³ããåäžããŸãããã®ã¢ãããŒãã¯ããšã³ã¿ãŒãã€ã³ã¡ã³ãããæè²çã³ã³ãã³ããŸã§ãããããçš®é¡ã®ã¢ããªã±ãŒã·ã§ã³ã«é©çšå¯èœã§ãã
5.4 ã²ãŒã éçºå ¥é
æ±çšæ§ã®é«ãActionscriptã¯ãã²ãŒã éçºã®äžçã«ãããŠããã®åãçºæ®ããŸããåçŽãªã¯ãªãã¯ã²ãŒã ãããè€éãªãã«ããã¬ã€ã€ãŒãªã³ã©ã€ã³ã²ãŒã ãŸã§ãããŸããŸãªã¿ã€ãã®ã²ãŒã ãå¶äœããããšãå¯èœã§ãã
Actionscriptã«ãããã²ãŒã éçºã«ã¯ããã£ã©ã¯ã¿ãŒã®åããè¡çªæ€åºãã¹ã³ã¢èšç®ãã²ãŒã ã®ç¶æ 管çãªã©ãå€å²ã«ããããã¯ããã¯ãå©çšãããŸããã³ãŒããéããŠãããã®æŠå¿µãå®è£ ããããšã§ããã¬ãŒã€ãŒã«ãšã£ãŠææŠçã§æ¥œããã²ãŒã ãäœãããšãã§ããŸãã
ã¢ãã¡ãŒã·ã§ã³ãã€ã³ã¿ã©ã¯ãã£ããªã³ã³ãã³ãäœãã®æè¡ã¯ãã²ãŒã éçºã«ãšã£ãŠå¿ èŠäžå¯æ¬ ãªèŠçŽ ã§ãããããã®èŠçŽ ãçµã¿åãããŠãActionscriptã䜿ã£ãé åçãªã²ãŒã ãåµé ããã®ããéçºè ã«ãšã£ãŠã®æ倧ã®ææŠã§ãã
以äžããActionscriptã䜿ã£ãã¢ãã¡ãŒã·ã§ã³ãã€ã³ã¿ã©ã¯ãã£ãã³ã³ãã³ãã®äœæããããŠã²ãŒã éçºã®åºæ¬çãªã¢ãããŒãã§ããããããç解ããå®éã«æãåãããŠã¿ãããšã§ãããªããããžã¿ã«ã³ã³ãã³ãã®å¶äœã«ãããŠæ°ããªå°å¹³ãéãããšãã§ããã§ãããã
6. Actionscriptããã°ã©ãã³ã°Tips
6.1 ããã©ãŒãã³ã¹æé©åã®åºæ¬
ActionScriptã䜿çšããéã«ã¯ããã¥ãŒãã³ã°ãè¡ã£ãŠæé«ã®ããã©ãŒãã³ã¹ãåŒãåºãããšãéèŠã§ããããã§ã¯ããã©ãŒãã³ã¹æé©åã®åºæ¬çãªã¢ãããŒãã«çŠç¹ãåœãŠãŸãã
äžã€ç®ã®ãã€ã³ãã¯ãã ãŒããŒã¯ãªãããç»åã¢ã»ããã®äœ¿çšãæå°éã«æããããšã§ããéå°ãªã°ã©ãã£ãã¯èŠçŽ ã¯åŠçè² è·ãé«ããããã©ãŒãã³ã¹ãäœäžãããŸããã§ããéããã¯ã¿ãŒã°ã©ãã£ãã¯ã¹ãå©çšããããããããã¯å¿ èŠãªå Žåã®ã¿äœ¿çšããŸãããã
次ã«ãã€ãã³ããªã¹ããŒã®ç®¡çããã¡ããšè¡ããäžèŠã«ãªã£ããªã¹ããŒã¯é©å®åé€ããããšãéèŠã§ããã¬ããŒãžã³ã¬ã¯ã·ã§ã³ã«ããã¡ã¢ãªç®¡çãæèãã䜿çšãããªããªã£ããªããžã§ã¯ãã¯ããã°ã©ã ããé€å»ããããã«ãããšè¯ãã§ãããã
6.2 åå©çšå¯èœãªã³ãŒãã®äœæ
å¹ççãªActionScriptã®éçºã«ã¯ãåå©çšå¯èœãªã³ãŒããäœãããšãããŒãšãªããŸãããã®ã¢ãããŒãã«ãããéçºæéã®ççž®ã«å ããããžã§ã¯ãå šäœã®ç®¡çã容æã«ãªããŸãã
åå©çšæ§ãé«ããããã«ã¯ãé¢æ°ãã¯ã©ã¹ãæ±çšçã«äœãããšãå¿æããŠãã ãããç¹å®ã®ã¿ã¹ã¯ã«ç¹åããæ©èœããããå€ç®çã«å¯Ÿå¿ã§ããã³ãŒãã®æ¹ãåå©çšããããã§ãããŸããã¢ãžã¥ãŒã«æ§ãé«ããããã«ã¯ãã³ãŒããå°ããªéšåã«åå²ãããšè¯ãã§ãããã
ããã«éèŠãªããšã¯ãããã¥ã¡ã³ããšã³ã¡ã³ããå å®ãããŠããããšã§ããã³ãŒãèªäœã®è§£èªã«æéããããå Žåããã®åå©çšæ§ã¯äœããªã£ãŠããŸããŸããé©åãªã³ã¡ã³ããã€ããä»ã®éçºè ãç解ããããæ§é ãæèããŠãã ããã
6.3 ã»ãã¥ãªãã£ãã¹ããã©ã¯ãã£ã¹
ActionScriptã䜿çšããäžã§ãã¢ããªã±ãŒã·ã§ã³ã®ã»ãã¥ãªãã£ã¯éåžžã«éèŠã§ãããŠãŒã¶ãŒã®ããŒã¿ãä¿è·ããä¿¡é Œæ§ã®é«ããããã¯ããæäŸããããã«ããã¹ããã©ã¯ãã£ã¹ãéµå®ããå¿ èŠããããŸãã
äŸãã°ãå€éšããã®å ¥åã«ã¯åžžã«æççã§ããã¹ãã§ããå ¥åæ€èšŒ(validation)ã培åºããSQLã€ã³ãžã§ã¯ã·ã§ã³ãã¯ãã¹ãµã€ãã¹ã¯ãªããã£ã³ã°(XSS)ãªã©ã®äžè¬çãªæ»æããå®ãããšãäžå¯æ¬ ã§ããå ¥åãããããŒã¿ã¯ãµãã¿ã€ãºããŠããåŠçããã¹ãã§ãã
ãŸããæå·åæè¡ã®é©åãªå©çšã¯ãããŒã¿ã®å®å šæ§ãä¿ã€äžã§å¿ èŠäžå¯æ¬ ã§ãããã¹ã¯ãŒãã®åãæ±ãã¯ç¹ã«æ éã«è¡ããããã·ã¥åãæå·åãé©åã«æœããŠãŠãŒã¶ãŒæ å ±ãä¿è·ããããšãæ±ããããŸãã
6.4 ã³ãã¥ããã£ãšãªãœãŒã¹
ActionScriptã®åŠç¿ãéçºãé²ããã«ããã£ãŠã¯ãã³ãã¥ããã£ããªã³ã©ã€ã³ãªãœãŒã¹ã倧ããªåœ¹å²ãæãããŸãã圹ç«ã€æ å ±ãææ°ã®ãã¯ããã¯ãå ±æããå ŽãšããŠéå®ããŸãã
éçºè åãã®ãã©ãŒã©ã ããã¥ãŒããªã¢ã«ãµã€ãã掻çšããçåç¹ã解æ¶ãããæ°ããã³ãŒãã®æžãæ¹ãåŠã¹ããšè¯ãã§ãããããŸãããªãŒãã³ãœãŒã¹ãããžã§ã¯ãã«åå ããããšã§ãå®éã®ã³ãŒããèŠãããä»ã®éçºè ãšã®ã³ã©ãã¬ãŒã·ã§ã³ãçµéšããããšãå¯èœã§ãã
ããã«ãå ¬åŒããã¥ã¡ã³ãããªãã¡ã¬ã³ã¹ã¬ã€ãã¯æãä¿¡é Œã®ããããªãœãŒã¹ã§ããã³ãŒãã®æ£ãã䜿çšæ¹æ³ãããã©ãŒãã³ã¹ã®ãã³ããªã©ãå ¬åŒã®æ å ±ã¯åžžã«ææ°ã®ç¶æ ãä¿ã€ããåªããå¿ èŠããããŸãã