{"id":109,"date":"2008-11-30T00:00:35","date_gmt":"2008-11-30T07:00:35","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=253"},"modified":"2008-11-30T00:00:35","modified_gmt":"2008-11-30T07:00:35","slug":"isometric-box","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=109","title":{"rendered":"Isometric Box"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\nstage.frameRate = 30;\r\n\r\nfor (var i:int = 0; i&lt;100; i++){\r\n    makeBoxSegment(200, 200 - i, i * 2);\r\n}\r\n\r\nfunction makeBoxSegment(xp:Number, yp:Number, col:uint):Sprite {\r\n\tvar isoBox:Sprite = Sprite(addChild(new Sprite()));\r\n\twith (isoBox) scaleY = .5, y = yp, x = xp;\r\n\tvar box:Shape = Shape(isoBox.addChild(new Shape()));\r\n\tbox.rotation = 45;\r\n\twith (box.graphics) beginFill(col), drawRect(-50,-50,100,100);\r\n\tisoBox.addEventListener(Event.ENTER_FRAME, onRotate);\r\n\treturn isoBox;\r\n}\r\n\r\nfunction onRotate(evt:Event):void {\r\n\tevt.currentTarget.getChildAt(0).rotation = mouseX;\r\n}\r\n<\/pre>\n<p>An isometric box that rotates with the mouseX.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>stage.frameRate = 30; for (var i:int = 0; i&lt;100; i++){ makeBoxSegment(200, 200 &#8211; i, i * 2); } function makeBoxSegment(xp:Number, yp:Number, col:uint):Sprite { var isoBox:Sprite = Sprite(addChild(new Sprite())); with (isoBox) scaleY = .5, y = yp, x = xp; var box:Shape = Shape(isoBox.addChild(new Shape())); box.rotation = 45; with (box.graphics) beginFill(col), drawRect(-50,-50,100,100); isoBox.addEventListener(Event.ENTER_FRAME, onRotate); return isoBox; [&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,33],"tags":[3,4,76,77],"class_list":["post-109","post","type-post","status-publish","format-standard","hentry","category-displayobject","category-graphics","tag-actionscript","tag-flash","tag-gradient","tag-isometric"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/109","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=109"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/109\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}