Posted By

chrisaiv on 03/29/09


Tagged

twitter Flex mxml


Versions (?)

Flex: Simple Twitter Example


 / Published in: MXML
 

URL: http://gotoandlearn.com/play?id=99

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
  3. <mx:Script>
  4. <![CDATA[
  5. import mx.rpc.events.ResultEvent;
  6. import mx.collections.ArrayCollection;
  7.  
  8. [Bindable]
  9. private var ac:ArrayCollection = new ArrayCollection();
  10.  
  11. private var searchURL:String = "http://search.twitter.com/search.atom?q=";
  12.  
  13. private function viewSearch( e:MouseEvent ):void
  14. {
  15. httpService.url = searchURL + textInput.text;
  16. httpService.send();
  17. }
  18.  
  19. private function onHttpServiceResultHandler( e:ResultEvent ):void
  20. {
  21. ac = e.result.feed.entry as ArrayCollection;
  22. }
  23.  
  24. ]]>
  25. </mx:Script>
  26. <mx:HTTPService id="httpService" result="onHttpServiceResultHandler(event)" />
  27. <mx:TextInput id="textInput" text="Adobe" width="387" top="10" left="10"/>
  28. <mx:Button label="Search" right="10" top="10" click="viewSearch(event)"/>
  29. <mx:List left="10" top="40" right="10" bottom="10" dataProvider="{ac}" labelField="title" />
  30.  
  31. </mx:Application>

Report this snippet  

You need to login to post a comment.