{"id":54,"date":"2008-02-15T18:35:43","date_gmt":"2008-02-15T17:35:43","guid":{"rendered":"http:\/\/www.crydust.be\/blog\/2008\/02\/15\/forcesmoothing\/"},"modified":"2008-02-14T18:42:18","modified_gmt":"2008-02-14T17:42:18","slug":"forcesmoothing","status":"publish","type":"post","link":"https:\/\/www.crydust.be\/blog\/2008\/02\/15\/forcesmoothing\/","title":{"rendered":"forceSmoothing"},"content":{"rendered":"<p>Rotating and scaling pictures in flash is easy. Just use _rotation, _xscale and _yscale. Except when you publish an swf for Flash Player 8 or newer. Every image you rotate or scale will become jagged. Very anoying. To remedy this you can either publish for Flash 7 or use a <a href=\"http:\/\/www.kaourantin.net\/2005\/12\/dynamically-loading-bitmaps-with.html\">complicated loadBitmapSmoothed function that uses BitmapData<\/a>.<\/p>\n<p>When Flash Player 8.5 came out it introduced the <a href=\"http:\/\/livedocs.adobe.com\/flash\/9.0\/main\/00001912.html\">forceSmoothing<\/a> property. This property is also available in as2. Now all we need to do is set it to true when we load images. Don&#8217;t forget that this will have no effect in Flash players older than version 8.5!<\/p>\n<p>It works quite well. In the example below you can clearly see the left picture is more jagged than the right one.<\/p>\n<p><!--more--><\/p>\n<div id=\"forcesmoothing\"><\/div>\n<p><script type=\"text\/javascript\">\nvar so = new SWFObject(\"http:\/\/www.crydust.be\/blog\/wp-content\/uploads\/forcesmoothing.swf\", \"forcesmoothing_swf\", \"400\", \"200\", \"9\", \"#FFFFFF\");\nso.addParam(\"base\", \".\");\nso.write(\"forcesmoothing\");\n<\/script><\/p>\n<pre class=\"prettyprint\">\r\nvar outer_mc = this.createEmptyMovieClip(&quot;outer_mc&quot;, 0);\r\nvar inner_mc = outer_mc.createEmptyMovieClip(&quot;inner_mc&quot;, 0);\r\n\r\n\/\/ don't rotate the inner_mc\r\n\/\/ it will lose its properties when the image is loaded\r\nouter_mc._rotation = 45;\r\nouter_mc._xscale = 120;\r\nouter_mc._yscale = 60;\r\n\r\nvar mcl:MovieClipLoader = new MovieClipLoader();\r\n\r\nmcl.addListener({\r\n  onLoadInit: function(target:MovieClip){\r\n    \/\/ this prevents that awfully jagged look\r\n    target.forceSmoothing = true;\r\n  }\r\n});\r\n\r\nmcl.loadClip(&quot;image.jpg&quot;, inner_mc);\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Rotating and scaling pictures in flash is easy. Just use _rotation, _xscale and _yscale. Except when you publish an swf for Flash Player 8 or newer. Every image you rotate or scale will become jagged. Very anoying. Tinic Uro even wrote a <a href=\"http:\/\/www.kaourantin.net\/2005\/12\/dynamically-loading-bitmaps-with.html\">loadBitmapSmoothed function that uses BitmapData<\/a>.<\/p>\n<p>When Flash Player 8.5 came out it introduced the <a href=\"http:\/\/livedocs.adobe.com\/flash\/9.0\/main\/00001912.html\">forceSmoothing<\/a> property. This property is also available in as2. Now all we need to do is set it to true when we load images.<\/p>\n<p>I works quite well. In the example below you can clearly see the left picture is more jagged than the right one.<\/p>\n<p> <a href=\"https:\/\/www.crydust.be\/blog\/2008\/02\/15\/forcesmoothing\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-54","post","type-post","status-publish","format-standard","hentry","category-flash"],"_links":{"self":[{"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/posts\/54","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/comments?post=54"}],"version-history":[{"count":0,"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/posts\/54\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/media?parent=54"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/categories?post=54"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/tags?post=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}