{"id":131,"date":"2009-07-09T11:30:57","date_gmt":"2009-07-09T09:30:57","guid":{"rendered":"http:\/\/blog.ansuz.nl\/?p=131"},"modified":"2009-07-09T11:30:57","modified_gmt":"2009-07-09T09:30:57","slug":"five3d-multiline-wordwrapping-text","status":"publish","type":"post","link":"http:\/\/blog.ansuz.nl\/index.php\/2009\/07\/09\/five3d-multiline-wordwrapping-text\/","title":{"rendered":"Five3D multiline wordwrapping text"},"content":{"rendered":"<p>A couple of days ago I had a look into <a href=\"http:\/\/five3d.mathieu-badimon.com\/\" target=\"_blank\">Five3D<\/a> just because I had some time on my hands and I wanted to check out Five3D for a while now. One big thing I missed in this vector based 3D engine was word wrapping for text. A Google search led me to <a href=\"http:\/\/blog.almostlogical.com\/2009\/06\/23\/multiline-wordwrap-dynamictext3d-in-five3d\/\" target=\"_blank\">an inaccessible blog<\/a>, so I decide to write the word wrapping myself.<\/p>\n<p>Download the file here: <a href=\"http:\/\/ansuz.nl\/toys\/five3d\/DynamicText3D.as\" target=\"_blank\">Updated DynamicText3D.as<\/a> (Compatible with v2.1.2)<\/p>\n<p>Usage:<\/p>\n<div id=\"ig-sh-1\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">ActionScript<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"actionscript\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">var<\/span> text3d: DynamicText3D = <span style=\"color: #000000;font-weight: bold\">new<\/span> DynamicText3D<span style=\"color: #66cc66\">&#040;<\/span>HelveticaBold<span style=\"color: #66cc66\">&#041;<\/span>;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">text3d.<span style=\"color: #0066CC\">size<\/span> = <span style=\"color: #cc66cc\">40<\/span>;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">text3d.<span style=\"color: #0066CC\">color<\/span> = 0xffffff;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #808080;font-style: italic\">\/\/ set a maximum width for the text<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">text3d.<span style=\"color: #006600\">maxWidth<\/span> = <span style=\"color: #cc66cc\">220<\/span>;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #808080;font-style: italic\">\/\/ flick word wrapping on<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">text3d.<span style=\"color: #0066CC\">wordWrap<\/span> = <span style=\"color: #000000;font-weight: bold\">true<\/span>;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">text3d.<span style=\"color: #0066CC\">text<\/span> = <span style=\"color: #ff0000\">&quot;Something long enough to actually wrap...&quot;<\/span>;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #808080;font-style: italic\">\/\/ Traces out the height of the text<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #0066CC\">trace<\/span><span style=\"color: #66cc66\">&#040;<\/span><span style=\"color: #ff0000\">&quot;text3d.textHeight&quot;<\/span><span style=\"color: #66cc66\">&#041;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>I know it&#8217;s not perfect, but it&#8217;s working for me! \ud83d\ude09<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>A couple of days ago I had a look into Five3D just because I had some time on my hands and I wanted to check out Five3D for a while now. One big thing I missed in this vector based &hellip; <a href=\"http:\/\/blog.ansuz.nl\/index.php\/2009\/07\/09\/five3d-multiline-wordwrapping-text\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-131","post","type-post","status-publish","format-standard","hentry","category-actionscript-30"],"_links":{"self":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts\/131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/comments?post=131"}],"version-history":[{"count":2,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts\/131\/revisions"}],"predecessor-version":[{"id":133,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts\/131\/revisions\/133"}],"wp:attachment":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/media?parent=131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/categories?post=131"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/tags?post=131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}