{"id":90,"date":"2008-11-11T00:00:37","date_gmt":"2008-11-11T07:00:37","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=84"},"modified":"2008-11-11T00:00:37","modified_gmt":"2008-11-11T07:00:37","slug":"set-multiple-properties","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=90","title":{"rendered":"Set Multiple Properties"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\n\/\/ set multiple properties of an Object \r\nfunction setProps(o:*, props:Object):void{\r\n\tfor (var key:String in props){\r\n\t\t o&#x5B;key] = props&#x5B;key];\r\n\t}\r\n}\r\n\r\n\/\/ example: \r\n\r\nvar s:Sprite = new Sprite();\r\ns.graphics.beginFill(0);\r\ns.graphics.drawRect(0,0,10,10);\r\naddChild(s);\r\n\r\n\/\/ set some properties\r\nsetProps(s, {x:100, y:100, scaleX:2, scaleY:2, rotation:45});\r\n<\/pre>\n<p>This was inspired by tweening engines like <a href='http:\/\/blog.greensock.com\/tweenliteas3\/'>TweenLite<\/a>. <\/p>\n<p>Basically the same thing using a with statement:<\/p>\n<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\nwith(s) x = 100, y = 100, scaleX = 2, scaleY = 2, rotation = 45;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/\/ set multiple properties of an Object function setProps(o:*, props:Object):void{ for (var key:String in props){ o&#x5B;key] = props&#x5B;key]; } } \/\/ example: var s:Sprite = new Sprite(); s.graphics.beginFill(0); s.graphics.drawRect(0,0,10,10); addChild(s); \/\/ set some properties setProps(s, {x:100, y:100, scaleX:2, scaleY:2, rotation:45}); This was inspired by tweening engines like TweenLite. Basically the same thing using a with [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,10],"tags":[],"class_list":["post-90","post","type-post","status-publish","format-standard","hentry","category-object","category-properties"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/90","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=90"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/90\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=90"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=90"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=90"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}