{"id":97,"date":"2008-11-18T00:00:10","date_gmt":"2008-11-18T07:00:10","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=206"},"modified":"2008-11-18T00:00:10","modified_gmt":"2008-11-18T07:00:10","slug":"skew-displayobject","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=97","title":{"rendered":"Skew DisplayObject"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\nvar box:Shape = Shape(addChild(new Shape()));\r\nwith (box.graphics) beginFill(0x006666), drawRect(0,0,50,50);\r\nbox.x = box.y = 100;\r\n\r\naddEventListener(Event.ENTER_FRAME, onLoop);\r\n\r\nfunction onLoop(evt:Event):void {\r\n\t\r\n\tvar m:Matrix = box.transform.matrix;\r\n\t\/\/ skew on the X\r\n\tm.c = (mouseX - stage.stageWidth \/ 2 ) \/ stage.stageWidth;\r\n\t\r\n\t\/\/ skew on the Y\r\n\t\/\/ m.b = (mouseX - stage.stageWidth \/ 2 ) \/ stage.stageWidth \r\n\t\r\n\tbox.transform.matrix = m\r\n}\r\n<\/pre>\n<p>This skews a box Shape using the c and b properties of the transformation matrix. Note that these values don&#8217;t match those in the IDE&#8217;s transform window. <a href=\"http:\/\/www.senocular.com\/flash\/tutorials\/transformmatrix\/\">This<\/a> is good further reading if your interested in this topic.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>var box:Shape = Shape(addChild(new Shape())); with (box.graphics) beginFill(0x006666), drawRect(0,0,50,50); box.x = box.y = 100; addEventListener(Event.ENTER_FRAME, onLoop); function onLoop(evt:Event):void { var m:Matrix = box.transform.matrix; \/\/ skew on the X m.c = (mouseX &#8211; stage.stageWidth \/ 2 ) \/ stage.stageWidth; \/\/ skew on the Y \/\/ m.b = (mouseX &#8211; stage.stageWidth \/ 2 ) \/ stage.stageWidth box.transform.matrix [&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,13],"tags":[3,4,61],"class_list":["post-97","post","type-post","status-publish","format-standard","hentry","category-displayobject","category-motion","tag-actionscript","tag-flash","tag-matrices"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/97","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=97"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}