
{"id":1040,"date":"2009-08-12T09:00:53","date_gmt":"2009-08-12T08:00:53","guid":{"rendered":"http:\/\/www.matthijskamstra.nl\/blog\/?p=1040"},"modified":"2009-08-04T15:29:13","modified_gmt":"2009-08-04T14:29:13","slug":"my-first-air-app-swf2gif-banner-part-1","status":"publish","type":"post","link":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/08\/12\/my-first-air-app-swf2gif-banner-part-1\/","title":{"rendered":"My first AIR app: SWF2GIF-banner &#8211; part 1"},"content":{"rendered":"<p>Sometimes, and I&#8217;m not very fond of them, I need to make banners&#8230;..<br \/>\nThe animation part is not so bad, but making the different sizes&#8230;. that can be a drag.<br \/>\nAnd after you made the SWF banners, you also need to make the animation in GIF.<\/p>\n<p>This is how I use to do it: <\/p>\n<ol>\n<li>make the SWF banner<\/li>\n<li>embed it in a html page with a background color that is not in the banner itself (a border around the SWF banner helps)<\/li>\n<li>make snapshots of the animation<\/li>\n<li>open photoshop >> (I used a action for this part&#8230;.)<\/li>\n<li>place all the images in one document<\/li>\n<li>cut the browser from the screenshot<\/li>\n<li>select the background-color reverse the selection and cut<\/li>\n<li>make a animation from all the layers (end photoshop action)<\/li>\n<li>save<\/li>\n<\/ol>\n<p>I have never made an AIR application but I think that it should be possible to make a SWF2GIF converter in AIR.<\/p>\n<p>Stuff what I need to find out:<\/p>\n<ul>\n<li>browse for a file<\/li>\n<li>load that file into air<\/li>\n<li>take snapshots of the animation<\/li>\n<li>controle the frame rate of the animation<\/li>\n<li>make a animated gif <\/li>\n<li>save everything<\/li>\n<li>etc.<\/li>\n<\/ul>\n<p><strong>Lets start with some basic:<\/strong><br \/>\nI&#8217;m still working on CS3, and it seems that AIR default is installed with CS4<br \/>\nInstalling the Adobe AIR update for Flash CS3<\/p>\n<p>English: <a href=\"http:\/\/help.adobe.com\/en_US\/AIR\/1.5\/devappsflash\/WS5b3ccc516d4fbf351e63e3d118666ade46-7fc3.html\">http:\/\/help.adobe.com\/en_US\/AIR\/1.5\/devappsflash\/WS5b3ccc516d4fbf351e63e3d118666ade46-7fc3.html<\/a><br \/>\nDutch: <a href=\"http:\/\/help.adobe.com\/nl_NL\/AIR\/1.5\/devappsflash\/WS5b3ccc516d4fbf351e63e3d118666ade46-7fc3.html\">http:\/\/help.adobe.com\/nl_NL\/AIR\/1.5\/devappsflash\/WS5b3ccc516d4fbf351e63e3d118666ade46-7fc3.html<\/a><\/p>\n<p>You can also use FlashDevelop 3.0.1, AIR is also installed with that program and in combination with Flex sdk you don&#8217;t even need Flash.<\/p>\n<p>Because I&#8217;m not finished with it (I will only work on it when I have to build banners) I will post now and then some parts of the code.<\/p>\n<p>For some reason I couldn&#8217;t find the code to load SWF into AIR using &#8220;browse&#8221;.<\/p>\n<p>[as light=&#8221;false&#8221; wraplines=&#8221;true&#8221;]<br \/>\nprivate function openSwfFile(e:MouseEvent = null):void<br \/>\n{<br \/>\n\tvar imagesFilter:FileFilter = new FileFilter(&quot;Flash SWF&quot;, &quot;*.swf&quot;);<br \/>\n\tmyFile = new File();<br \/>\n\tmyFile.addEventListener(Event.SELECT, selectHandler);<br \/>\n\tmyFile.browseForOpen(&quot;Open&quot;, [imagesFilter]);<br \/>\n}<\/p>\n<p>private function selectHandler(event:Event):void<br \/>\n{<br \/>\n\tmyFile.removeEventListener(Event.SELECT, selectHandler);<br \/>\n\tloadSWF(myFile.url);<br \/>\n}<\/p>\n<p>private function loadSWF(inName:String):void<br \/>\n{<br \/>\n\ttrace( &quot;Main.loadSWF &gt; inName : &quot; + inName );<br \/>\n\tmLoader = new Loader();<br \/>\n\tmLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);<br \/>\n\tmLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onErrorComplete);<br \/>\n\tmLoader.load(new URLRequest(inName));<br \/>\n}<br \/>\nprivate function onLoaderComplete(e:Event):void { startOnEnterFrameHandler(); }<br \/>\nprivate function onErrorComplete(e:IOErrorEvent):void { trace( &quot;Main.onErrorComplete &gt; e : &quot; + e ); }<\/p>\n<p>private function startOnEnterFrameHandler():void<br \/>\n{<br \/>\n\t_movie.addChild(mLoader);<br \/>\n\t\/\/ _movie.addEventListener(Event.ENTER_FRAME , onEnterFrameHandler);<br \/>\n}<br \/>\n[\/as]<br \/>\njust use a button to activate.<\/p>\n<p>I know the code is not complete&#8230; and that some classes have strange names&#8230; it&#8217;s work in progress.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes, and I&#8217;m not very fond of them, I need to make banners&#8230;.. The animation part is not so bad, but making the different sizes&#8230;. that can be a drag. And after you made the SWF banners, you also need to make the animation in GIF. This is how I use to do it: make [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,3],"tags":[296,398,159,297,193],"class_list":["post-1040","post","type-post","status-publish","format-standard","hentry","category-as3","category-flash","tag-animated-gif","tag-flash","tag-flashdevelop","tag-sdk","tag-swf"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/1040","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/comments?post=1040"}],"version-history":[{"count":7,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/1040\/revisions"}],"predecessor-version":[{"id":1100,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/1040\/revisions\/1100"}],"wp:attachment":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/media?parent=1040"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/categories?post=1040"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/tags?post=1040"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}