topical media & game development

talk show tell print

professional-flex-code-06-RemoteDataProviders.mx

professional-flex-code-06-RemoteDataProviders.mx [swf] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
          creationComplete="srv.send()">
          
          <mx:Script>
                  <![CDATA[
                          import mx.rpc.events.ResultEvent;
                          import mx.collections.ArrayCollection;
                          
                          [Bindable]
                          public var videos:ArrayCollection;
                          
                          [Bindable]
                          public var DEV_ID:String = "ytapi-AEliëns-localmedia-n0ka63t1-1";
                          
                          public function handleResult(event:ResultEvent):void
                          {
                                  videos = event.result.ut_response.video_list.video;
                          }
                          
                  ]]>
          </mx:Script>
          
          <mx:HTTPService id="srv" url="http://gdata.youtube.com/feeds/api/standardfeeds/top_favorites"
                  useProxy="false"
                  result="handleResult(event)" />
          
          <mx:List width="500" height="500" dataProvider="{videos}">
                  <mx:itemRenderer>
                          <mx:Component>
                                  <mx:HBox height="105" verticalAlign="middle" verticalScrollPolicy="off" horizontalScrollPolicy="off">
                                          <mx:Image source="{data.thumbnail_url}" />
                                          <mx:VBox width="100%" height="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off">
                                                  <mx:Label text="{data.title}" fontFamily="Arial" fontSize="12" fontWeight="bold" />
                                                  <mx:Text text="{data.description}" width="100%" />
                                          </mx:VBox>
                                  </mx:HBox>
                          </mx:Component>
                  </mx:itemRenderer>
          </mx:List>
          
  </mx:Application>
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.