{"id":739,"date":"2011-09-15T11:08:23","date_gmt":"2011-09-15T02:08:23","guid":{"rendered":"http:\/\/www23.atpages.jp\/~inoni\/?p=739"},"modified":"2011-09-15T11:08:23","modified_gmt":"2011-09-15T02:08:23","slug":"actionscript3-0%e8%a6%9a%e6%9b%b8-%e6%96%87%e5%ad%97%e5%88%97%e3%81%a8%e3%83%90%e3%82%a4%e3%83%88%e6%95%b0","status":"publish","type":"post","link":"http:\/\/anada.cloudfree.jp\/?p=739","title":{"rendered":"ActionScript3.0\u899a\u66f8 \u6587\u5b57\u5217\u3068\u30d0\u30a4\u30c8\u6570"},"content":{"rendered":"<p>\u901a\u5e38\u306eTextField\u3060\u3068\u3001\u8907\u6570\u884c\u6307\u5b9a\u3057\u3066\u3084\u308c\u3070\u52dd\u624b\u306b\u6539\u884c\u3057\u3066\u304f\u308c\u308b\u3002<br \/>\n\u3060\u304c\u3001\u30e9\u30b8\u30aa\u30dc\u30bf\u30f3\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306e\u30e9\u30d9\u30eb\u306f\u6539\u884c\u3057\u3066\u304f\u308c\u306a\u3044\u30fb\u30fb\u30fb<\/p>\n<p>\u3067\u3001\u30e9\u30b8\u30aa\u30dc\u30bf\u30f3\u306eTextField\u306e<strong>wordWrap<\/strong>\u30d7\u30ed\u30d1\u30c6\u30a3\u3068\u304b\u3092\u3044\u3058\u308c\u3070\u3088\u3044\u3068\u3044\u3046\u3053\u3068\u3002<\/p>\n<p><a href=\"http:\/\/www.flash-jp.com\/modules\/newbb\/viewtopic.php?topic_id=9052&#038;forum=20\" title=\"RadioButton \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u6587\u5b57\u3092\u81ea\u52d5\u6539\u884c\u3055\u305b\u305f\u3044\" target=\"_blank\">FLASH-JP.COM RadioButton \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u6587\u5b57\u3092\u81ea\u52d5\u6539\u884c\u3055\u305b\u305f\u3044<\/a><\/p>\n<p>\u3060\u3051\u3069\u3001\u305d\u3082\u305d\u3082<strong>\u6307\u5b9a\u30d0\u30a4\u30c8\u6570\u3067\u6298\u308a\u8fd4\u3057\u305f\u3044\u3068\u304d\u3063\u3066\u3069\u3046\u3059\u3093\u306e\uff1f<\/strong>\u3068\u601d\u3063\u3066\u691c\u7d22\u3057\u305f\u3068\u3053\u308d\u3001\u3042\u308a\u304c\u305f\u3044\u8a18\u4e8b\u767a\u898b\u3002<\/p>\n<p><a href=\"http:\/\/yoshiweb.net\/blog\/?itemid=51\" title=\"yoshiweb.NET-blog ActionScript\u3067\u6587\u5b57\u5224\u5b9a\" target=\"_blank\">yoshiweb.NET-blog\u3000ActionScript\u3067\u6587\u5b57\u5224\u5b9a<\/a><\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u3092\u5143\u306b\u30c1\u30e3\u30ec\u30f3\u30b8\u3002<\/p>\n<p><strong>checkCode<\/strong>\u306f\u53c2\u7167\u5148\u305d\u306e\u307e\u307e\u3002<br \/>\n<strong>checkHalf<\/strong>\u306f\u3001\u30d0\u30a4\u30c8\u6570\u3092\u8fd4\u3059\u3088\u3046\u306b\u5909\u66f4\u3002<br \/>\n<strong>getStrBytesTotal<\/strong>\u306f\u3001checkHalf\u306e\u5909\u66f4\u306b\u4f34\u3044\u5909\u66f4\u3002<br \/>\n<strong>setReturnCode<\/strong>\u306f\u3001\u30aa\u30ea\u30b8\u30ca\u30eb\u3002<\/p>\n<pre class=\"brush:as3\">\/\/ \u6307\u5b9a\u30d0\u30a4\u30c8\u6570(default=60)\u3067\u6298\u308a\u8fd4\u3057\nfunction setReturnCode(str:String, max:int=60):String {\n\tvar cnt:int = 0;\n\tvar len:int = str.length;\n\tvar s:int = 0\n\tvar e:int = 0\n\tvar buf:String = '';\n\tfor (e = 0 ; e &lt; len ; e++ ) {\n\t\tcnt += checkHalf(str.substr(e, 1));\n\t\tif (cnt &gt;= max) {\n\t\t\tif (buf.length &gt; 0) {\n\t\t\t\tbuf += '\\r';\n\t\t\t}\n\t\t\tbuf += str.substr(s, e-s+1);\n\t\t\ts = e+1;\n\t\t\tcnt = 0;\n\t\t}\n\t}\n\tif (buf.length &gt; 0) {\n\t\tbuf += '\\r';\n\t}\n\tbuf += str.substr(s, e-s+1);\n\treturn buf;\n}\n\n\/\/ \u6587\u5b57\u5217\u306e\u30d0\u30a4\u30c8\u6570\u3092\u6c42\u3081\u308b\nfunction getStrBytesTotal(str:String):int {\n\tvar cnt:int = 0;\n\tvar len:int = str.length;\n\twhile (len--) {\n\t\tcnt += checkHalf(str.substr(len, 1));\n\t}\n\treturn cnt;\n}\n\n\/\/ \u6307\u5b9a\u6587\u5b57\u306e\u30d0\u30a4\u30c8\u6570\u3092\u6c42\u3081\u308b\u2192\u5168\u89d2\u306a\u30892\u3001\u534a\u89d2\u306a\u30891\u3092\u8fd4\u3059\nfunction checkHalf(str:String):int{\n\treturn (checkCode(str, 0x00, 0x7f) || checkCode(str, 0xFF61,0xFF9F)) ? 1 : 2; \n}\n\n\/\/ \u5168\u534a\u89d2\u5224\u5b9a\u2192\u5168\u89d2\u306a\u3089false\u3001\u534a\u89d2\u306a\u3089true\u3092\u8fd4\u3059\nfunction checkCode(str:String, min:uint, max:uint) {\n\tvar len:uint = str.length;\n\twhile (len--) {\n\t\tvar num:uint = str.substr(len, 1).charCodeAt(0);\n\t\tif (num &lt; min || num &gt; max) {\n\t\t\treturn false;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn true;\n}<\/pre>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u3044\u3044\u5869\u6885\u306b\u306f\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\uff08<strong>\u3042\u3093\u3070\u3044<\/strong>\u3063\u3066<strong>\u5869\u6885<\/strong>\u3063\u3066\u66f8\u304f\u3093\u3060\u306d\u3047\u30fb\u30fb\u30fb\u3088\u3044\u5869\u52a0\u6e1b\u306a\u306e\u306d\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u901a\u5e38\u306eTextField\u3060\u3068\u3001\u8907\u6570\u884c\u6307\u5b9a\u3057\u3066\u3084\u308c\u3070\u52dd\u624b\u306b\u6539\u884c\u3057\u3066\u304f\u308c\u308b\u3002 \u3060\u304c\u3001\u30e9\u30b8\u30aa\u30dc\u30bf\u30f3\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306e\u30e9\u30d9\u30eb\u306f\u6539\u884c\u3057\u3066\u304f\u308c\u306a\u3044\u30fb\u30fb\u30fb \u3067\u3001\u30e9\u30b8\u30aa\u30dc\u30bf\u30f3\u306eTextField\u306ewordWrap\u30d7\u30ed\u30d1\u30c6\u30a3\u3068\u304b\u3092\u3044\u3058\u308c\u3070\u3088\u3044 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[28,53,57],"class_list":["post-739","post","type-post","status-publish","format-standard","hentry","category-flashactionscript","tag-as3","tag-length","tag-multibyte"],"_links":{"self":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/posts\/739","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=739"}],"version-history":[{"count":0,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/posts\/739\/revisions"}],"wp:attachment":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=739"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=739"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=739"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}