{"id":5975,"date":"2014-04-11T06:57:29","date_gmt":"2014-04-11T06:57:29","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/11\/how-to-change-actionscript-1-2-to-actionscript-3-collection-of-common-programming-errors\/"},"modified":"2014-04-11T06:57:29","modified_gmt":"2014-04-11T06:57:29","slug":"how-to-change-actionscript-1-2-to-actionscript-3-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/11\/how-to-change-actionscript-1-2-to-actionscript-3-collection-of-common-programming-errors\/","title":{"rendered":"how to change actionscript 1-2 to actionscript 3-Collection of common programming errors"},"content":{"rendered":"<p>In flash, I created a button and gave the button this code (in AS1-AS2)<\/p>\n<pre><code>on (release)\n{\n    gotoAndPlay(5);\n    tellTarget(\"\/Anim\") \/\/'Anim' is just short form for 'an animation'\n\n    {\n        gotoAndPlay(5);\n    } \/\/ End of TellTarget\n}\n<\/code><\/pre>\n<p>Since you can&#8217;t give specific buttons actions in AS3, I gave the button an instance name (the buttons instance name is now &#8216;runButton&#8217;) and then decided to do this in the actions layer.<\/p>\n<pre><code>runButton.addEventListener(MouseEvent.CLICK, startAnimation);\n\n\nfunction startAnimation(event:MouseEvent){\n\n    gotoAndPlay(5);\n    tellTarget(\"\/Anim\")\n    {\n        gotoAndPlay(5);\n    } \/\/ End of TellTarget\n\n}\n<\/code><\/pre>\n<p>but it is giving me an error saying that a &#8216;{&#8216; is expected after the<\/p>\n<p>function startAnimation(event:MouseEvent):void{<\/p>\n<p>line and it is saying that there is an unexpected &#8216;}&#8217; on the last line. Any idea how to fix this?<\/p>\n<p>Note: Anim is a movieclip on the main timeline. When I double click the Anim movieclip, it has it&#8217;s own timeline. I want that timeline to play along with the main timeline, hence the &#8216;gotoandPlay(5) and then the other gotoAndPlay after doing &#8216;tellTarget(Anim&#8217;).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In flash, I created a button and gave the button this code (in AS1-AS2) on (release) { gotoAndPlay(5); tellTarget(&#8220;\/Anim&#8221;) \/\/&#8217;Anim&#8217; is just short form for &#8216;an animation&#8217; { gotoAndPlay(5); } \/\/ End of TellTarget } Since you can&#8217;t give specific buttons actions in AS3, I gave the button an instance name (the buttons instance name [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5975","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5975"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5975\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}