{"id":415,"date":"2011-12-08T14:53:07","date_gmt":"2011-12-08T14:53:07","guid":{"rendered":"https:\/\/greladesign.co\/blog\/?p=415"},"modified":"2011-12-08T14:53:07","modified_gmt":"2011-12-08T14:53:07","slug":"the-strings-replace-method-and-argumenterror-error-1063-argument-count-mismatch-error","status":"publish","type":"post","link":"https:\/\/greladesign.co\/blog\/2011\/12\/08\/the-strings-replace-method-and-argumenterror-error-1063-argument-count-mismatch-error\/","title":{"rendered":"The String&#8217;s replace method and ArgumentError: Error #1063: Argument count mismatch error"},"content":{"rendered":"<p>Hi,<\/p>\n<p>recently I have upgraded flash player (11.1.102.55), and suddenly found that one of my components was throwing following error:<\/p>\n<p><code><br \/>\nArgumentError: Error #1063: Argument count mismatch on Main\/removeLinkStyleClass(). Expected 0, got 6.<br \/>\n\tat String$\/_replace()<br \/>\n\tat String\/http:\/\/adobe.com\/AS3\/2006\/builtin::replace()<br \/>\n\tat Main\/init()[...\\bugs\\string_replace\\src\\Main.as:27]<br \/>\n\tat Main()[...\\bugs\\string_replace\\src\\Main.as:16]<\/code><\/p>\n<p>I was surprised as the code wasn&#8217;t changed and it was working earlier. When I have opened the problematic function I&#8217;ve noticed that it is the one used in replace function as the second parameter <i>AS3 function replace(pattern:*, repl:Object):String<\/i>. As I was creating this method following up the <a href=\"http:\/\/help.adobe.com\/en_US\/FlashPlatform\/reference\/actionscript\/3\/String.html#replace%28%29\" title=\"String#replace\">documentation<\/a> I was using the arguments object, however after the flash player update this error appeared. At first I was lost with that, but then I&#8217;ve tried with <a href=\"http:\/\/help.adobe.com\/en_US\/FlashPlatform\/reference\/actionscript\/3\/statements.html#..._%28rest%29_parameter\" title=\"The rest parameter\">&#8230;(rest)<\/a> parameter, and it worked!<\/p>\n<p>So if you will have the same problem try to modify your method to include the &#8230;(rest) parameter:<\/p>\n<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\nfunction replaceFunction(...args):String\r\n{\r\n\/\/do what ever you need with args and return string\r\n}\r\n<\/pre>\n<p>p.s. I will try to find the FP version when it started to be a problem, maybe it was announced?:)<\/p>\n<p>best regards<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, recently I have upgraded flash player (11.1.102.55), and suddenly found that one of my components was throwing following error: ArgumentError: Error #1063: Argument count mismatch on Main\/removeLinkStyleClass(). Expected 0, got 6. at String$\/_replace() at String\/http:\/\/adobe.com\/AS3\/2006\/builtin::replace() at Main\/init()[&#8230;\\bugs\\string_replace\\src\\Main.as:27] at Main()[&#8230;\\bugs\\string_replace\\src\\Main.as:16] &hellip; <a href=\"https:\/\/greladesign.co\/blog\/2011\/12\/08\/the-strings-replace-method-and-argumenterror-error-1063-argument-count-mismatch-error\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":""},"categories":[17,72,9],"tags":[12,116,114,304,115,301],"_links":{"self":[{"href":"https:\/\/greladesign.co\/blog\/wp-json\/wp\/v2\/posts\/415"}],"collection":[{"href":"https:\/\/greladesign.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/greladesign.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/greladesign.co\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/greladesign.co\/blog\/wp-json\/wp\/v2\/comments?post=415"}],"version-history":[{"count":7,"href":"https:\/\/greladesign.co\/blog\/wp-json\/wp\/v2\/posts\/415\/revisions"}],"predecessor-version":[{"id":423,"href":"https:\/\/greladesign.co\/blog\/wp-json\/wp\/v2\/posts\/415\/revisions\/423"}],"wp:attachment":[{"href":"https:\/\/greladesign.co\/blog\/wp-json\/wp\/v2\/media?parent=415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greladesign.co\/blog\/wp-json\/wp\/v2\/categories?post=415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greladesign.co\/blog\/wp-json\/wp\/v2\/tags?post=415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}