{"id":104,"date":"2010-07-22T08:35:26","date_gmt":"2010-07-22T08:35:26","guid":{"rendered":"http:\/\/todepoint.com\/blog\/?p=104"},"modified":"2010-07-22T08:35:26","modified_gmt":"2010-07-22T08:35:26","slug":"spinning_animation-as3","status":"publish","type":"post","link":"https:\/\/todepoint.com\/blog\/2010\/07\/22\/spinning_animation-as3\/","title":{"rendered":"Pure code AS3 spinning loading animation"},"content":{"rendered":"<p>While working on the video player, I wanted to show spinning loading animation while buffering, and since I decided that the whole thing will be pure code, with no library assets, I had to code this animation &#8211; just the kind of things I like.<br \/>\nIt didn&#8217;t take long, and I decided to share it &#8211; why not?\n<\/p>\n<p>So here it is:<\/p>\n<div id=\"loadAnimPlace\" style=\"border:1px solid #e0e0e0; text-align:center;\"><img loading=\"lazy\" src=\"http:\/\/www.todepoint.com\/adi\/as_examples\/loadAnimation\/loader_place.jpg\" width=\"450\" height=\"100\" border=\"0\" alt=\"loader animation with action script 3 code\" \/><\/div>\n<p><script type=\"text\/javascript\">\n\/\/ <![CDATA[\nvar ldAnim = new SWFObject(\"http:\/\/www.todepoint.com\/adi\/as_examples\/loadAnimation\/loader_anim.swf\", \"loadAnimSwf\", \"450\", \"100\", \"9\", \"#ffffff\");\nldAnim.write(\"loadAnimPlace\");\n\/\/ ]]>\n<\/script><\/p>\n<p>What you need to do in order to use it is add two functions:<\/p>\n<p><code><br \/>\nimport LoadAnim;<br \/>\n...<br \/>\nprivate var myAnim\t:LoadAnim;<br \/>\n...<\/p>\n<p>public function showAnim():void<br \/>\n{<br \/>\n\tmyAnim = new LoadAnim(0x333333);  \/\/ animation color<br \/>\n\tmyAnim.x = stage.stageWidth \/ 2;<br \/>\n\tmyAnim.y = stage.stageHeight \/ 2;<br \/>\n\taddChild(myAnim);<br \/>\n}<\/p>\n<p>public function hideAnim():void<br \/>\n{<br \/>\n\tmyAnim.stopAnim();<br \/>\n\tremoveChildAt(1);<br \/>\n}<br \/>\n<\/code><br \/>\nDownload the class <a href=\"http:\/\/www.todepoint.com\/adi\/as_examples\/loadAnimation\/LoadAnim.as\" title=\"download my pure code spinning loading animation class\">here<\/a>, enjoy : )<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While working on the video player, I wanted to show spinning loading animation while buffering, and since I decided that the whole thing will be pure code, with no library assets, I had to code this animation &#8211; just the kind of things I like.&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,10,12,16],"tags":[],"_links":{"self":[{"href":"https:\/\/todepoint.com\/blog\/wp-json\/wp\/v2\/posts\/104"}],"collection":[{"href":"https:\/\/todepoint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/todepoint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/todepoint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/todepoint.com\/blog\/wp-json\/wp\/v2\/comments?post=104"}],"version-history":[{"count":0,"href":"https:\/\/todepoint.com\/blog\/wp-json\/wp\/v2\/posts\/104\/revisions"}],"wp:attachment":[{"href":"https:\/\/todepoint.com\/blog\/wp-json\/wp\/v2\/media?parent=104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/todepoint.com\/blog\/wp-json\/wp\/v2\/categories?post=104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/todepoint.com\/blog\/wp-json\/wp\/v2\/tags?post=104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}