{"id":101,"date":"2008-11-22T00:00:47","date_gmt":"2008-11-22T07:00:47","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=204"},"modified":"2008-11-22T00:00:47","modified_gmt":"2008-11-22T07:00:47","slug":"movieclipprototype","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=101","title":{"rendered":"MovieClip.prototype"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\nMovieClip.prototype.tint = function(col:uint):void {\r\n\tvar ct:ColorTransform = transform.colorTransform;\r\n\tct.color = col;\r\n\tthis.transform.colorTransform = ct;\r\n}\r\n\r\nvar circle:MovieClip = MovieClip(addChild(new MovieClip()));\r\nwith (circle.graphics) {\r\n\tbeginFill(0x123455);\r\n\tdrawCircle(0,0,50);\r\n\tx = 100;\r\n\ty = 100;\r\n}\r\n\r\ncircle.tint(0xFF0000);\r\n<\/pre>\n<p>When AS3 first came out I didn&#8217;t realize that prototype was still around&#8230;. This adds a function called tint() to all MovieClips. You should extend MovieClip instead of using this method&#8230;. but it&#8217;s interesting to see that it&#8217;s still around. There&#8217;s an explanation of prototype and the AS3 namespace <a href=\"http:\/\/help.adobe.com\/en_US\/ActionScript\/3.0_ProgrammingAS3\/WS5b3ccc516d4fbf351e63e3d118a9b90204-7f3f.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7f17\">here.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>MovieClip.prototype.tint = function(col:uint):void { var ct:ColorTransform = transform.colorTransform; ct.color = col; this.transform.colorTransform = ct; } var circle:MovieClip = MovieClip(addChild(new MovieClip())); with (circle.graphics) { beginFill(0x123455); drawCircle(0,0,50); x = 100; y = 100; } circle.tint(0xFF0000); When AS3 first came out I didn&#8217;t realize that prototype was still around&#8230;. This adds a function called tint() to all MovieClips. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59,22],"tags":[3,4,64,60],"class_list":["post-101","post","type-post","status-publish","format-standard","hentry","category-color","category-movieclip","tag-actionscript","tag-flash","tag-prototype","tag-tint"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/101","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=101"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/101\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}