Adobe AIR and the API Feedburner: reloaded

Tuesday, November 18, 2008

I draw inspiration by the excellent tutorial Napolux, Flex 3, Adobe AIR and the Feedburner API, showing you how to write a simple application (or widget) Adobe AIR using Flex 3, to show how to achieve the exact same thing using Adobe Flash CS3. If desired, also, you can use the extension for creating Adobe AIR applications. It is not necessary for the purposes of this tutorial, compile the application as an executable AIR, you can use the proposed code as a simple Flash movie to "affix" to your Web pages

Flash vs Flex

Despite appreciate how technology and Adobe AIR has been deployed in platforms such as HTML (Dreamweaver), Flash and Flex, are not "still" quite well disposed towards Flex! I certainly do not compare Flash with Flex, even though they have many points in common but also many differences. However I have absolutely enjoyed the Adobe policy with respect to this spinoff sometimes meaningless. I would have preferred, instead, the creation of a single environment (Flax) development, and not this "useless" separation. Furthermore, as a good programmer, places too much "visual" I do not like crabs and Flex seems destined to become dangerously similar to Visual Basic, which among other things I know well and which I have worked for many years. In short, Flex I really do not understand and I did not understand what Adobe wants to do with this branch. If Flex is recommended as the ideal place to write what is the fate of Flash RIA? All the features of Flex, not actually available "directly" in Flash, could - wanting - to be inserted without force to purchase multiple licenses to develop - eventually - the exact same thing.

Differences between Flash and Flex

The first thing you'll notice the Flash version is the presence of a little 'more code. Indeed Flex solves some procedures directly using "his" MXML file. Upon closer examination, however, there is more code than you might think. The procedure more dense, which in Flex is "obscured", is the connection via the REST API Feedburner. One of the advantages of using a code written in Flash is that it can work immediately or as AIR applications and as a Flash movie on any Web page! Always if we did not use specific features of a amiente desktop. Moreover, and here's another reason why I am not convinced at all Flex, Adobe AIR application built with Flash is 5 times smaller than that proposed by Napolux and compiled with Flex Builder:

Note: To be fair this is attributable to a number of components (such as' mx.controls.Alert that are included in Flex and not in my version of Flash, ActionScript 3.0, in fact, a number of features was eliminated: all "packages" mx present in Actionscript 2.0 and Flex migrated now below! However I intend to carry out more tests as soon as possible in this regard.

Code

Deciding whether or not complete our movie as an Adobe AIR application (which you can do at any time thereafter), here's the document class Feedburner.as: (all codes are available on Google Code)

ActionScript
  1. package (
  2. / **
  3. * Class Document for Adobe AIR version FeedBurner
  4. * Original idea by Napolux.com (http://www.napolux.com/2008/flex-3-adobe-air-feedburner.html)
  5. *
  6. * @ Author Giovambattista Fazioli
  7. * @ Email @ g.fazioli undolog.com
  8. * @ Web http://www.undolog.com
  9. *
  10. * CHANGE LOG
  11. *
  12. * Ver 0.8
  13. * - First release Adobe AIR
  14. *
  15. * /
  16. .*; import flash.display .*;
  17. .*; import flash.text .*;
  18. .*; import flash.events .*;
  19. . URLLoader ; import flash.net. URLLoader;
  20. . URLRequestMethod ; import flash.net. URLRequestMethod;
  21. . URLRequest ; import flash.net. URLRequest;
  22. . URLVariables ; import flash.net. URLVariables;
  23. FeedBurner extends MovieClip { public class FeedBurner extends MovieClip (
  24. String = 'http://api.feedburner.com/awareness/1.0/GetFeedData' ; private const FEEDBURNER_API: String = 'http://api.feedburner.com/awareness/1.0/GetFeedData';
  25. FeedBurner ( ) : void { public function FeedBurner (): void (
  26. "construtor::FeedBurner" ) ; trace ( "Construtor:: FeedBurner");
  27. Event . ADDED_TO_STAGE , init ) ; addEventListener (Event. ADDED_TO_STAGE, init);
  28. )
  29. / /
  30. init ( e : Event = null ) : void { private function init (e: Event = null): void (
  31. = '' ; result_txt. text ='';
  32. = 'http://www.undolog.com/feed' ; feed_url. text = 'http://www.undolog.com/feed';
  33. / /
  34. ( MouseEvent . CLICK , checkFeedBurnerReaders ) ; check_btn. addEventListener (MouseEvent. CLICK, checkFeedBurnerReaders);
  35. )
  36. / /
  37. checkFeedBurnerReaders ( e : MouseEvent = null ) : void { private function checkFeedBurnerReaders (e: MouseEvent = null): void (
  38. "FeedBurner::checkFeedBurnerReaders()" ) ; trace ( "FeedBurner:: checkFeedBurnerReaders ()");
  39. / /
  40. : URLLoader = new URLLoader ( ) ; var loader: URLLoader = new URLLoader ();
  41. URLRequest = new URLRequest ( ) ; var urlReq: URLRequest = new URLRequest ();
  42. URLVariables = new URLVariables ( ) ; var param: URLVariables = new URLVariables ();
  43. / /
  44. = feed_url . text ; param. uri = feed_url. text;
  45. = FEEDBURNER_API ; urlReq. url = FEEDBURNER_API;
  46. = URLRequestMethod . GET ; urlReq. method = URLRequestMethod. GET;
  47. = param ; urlReq. data = param;
  48. / /
  49. dataFormat = URLLoaderDataFormat . TEXT ; loader. DataFormat = URLLoaderDataFormat. TEXT;
  50. addEventListener ( Event . COMPLETE , completeHandler ) ; loader. addEventListener (Event. COMPLETE completeHandler);
  51. try (
  52. load ( urlreq ) ; loader. load (urlReq);
  53. ( error : Error ) { ) Catch (error: Error) (
  54. "Errore nel caricamento dell' URL" ) ; trace ( "Error Loading 'URL');
  55. )
  56. event : Event ) : void { completeHandler function (event: Event): void (
  57. / / <rsp stat="ok">
  58. / / <feed Id="651641" uri="undolog">
  59. / / <entry Date="2008-11-17" circulation="389" hits="1348" downloads="0" reach="43"/>
  60. / / </ Feed>
  61. / / </ rsp>
  62. XML = XML ( event . target . data ) ; var x_xml: XML = XML (event. target. data);
  63. x_xml . @stat == 'ok' ) result_txt . text = x_xml . feed . entry . @circulation . toString ( ) ; if (x_xml. @ stat == 'ok') result_txt. text = x_xml. feed. entry. @ circulation. toString ();
  64. text = '0' ; result_txt else. text = '0 ';
  65. )
  66. )
  67. )
  68. )

The part of the interface is available on Feedburner.fla.

Related Post

Was this article helpful?: Per nientePocoAbbastanzaMoltoMoltissimo
Loading ... Loading ...

3 comments to "Adobe AIR and the API Feedburner: Reloaded"

  1. getAvatar 1.0
    November 18, 2008 Napolux:

    Also your excellent tutorial!
    Flash or Flex? I prefer Flex ... Perhaps it is the feeling of "this is for developers, flash designer," I do not know. Appearance among other things to see what combination of Thermo P

  2. getAvatar 1.0
    January 10, 2009 Napolux:

    Did you update the script to count the readers of those passed to feedproxy.google.com?

  3. getAvatar 1.0
    January 12, 2009 Giovambattista Fazioli:

    @ Napolux:

    Did you update the script to count the readers of those passed to feedproxy.google.com?

    No. .. My code was planning purposes only : D I leave to you the realization of the version "good" : D

Leave a comment

TAG XHTML PERMISSIONS: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERTION CODE:
 <pre></pre>         // blocco generico [code][/code]       // blocco generico [as][/as]           // Actionscript [css][/css]         // CSS Style Sheet [html][/html]       // HTML [js][/js]           // Javascript [objc][/objc]       // Objective-C [php][/php]         // PHP [sql][/sql]         // SQL