Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Flex Buzznet API Browser

DZone's Guide to

Flex Buzznet API Browser

·
Free Resource
Connection to Buzznet's api service with http auth.

Flex Code:



  

  

  
	
	
   
		
	
   

	
   
    
		
		
			import mx.managers.PopUpManager;
			import mx.core.IFlexDisplayObject;
			import mx.utils.Base64Encoder;
		

			import mx.utils.ArrayUtil;		
			import mx.rpc.events.ResultEvent;
			import mx.controls.Alert;
			import mx.rpc.events.FaultEvent;			
			
			[Bindable] private var dataArr:Array;
			[Bindable] private var apikey:String = "APIKEY";

			private function onResult( event:ResultEvent ):void
			{
				hideLoading();
				dataArr = ArrayUtil.toArray( event.result );;
			}			
			
			private function onFault( event:FaultEvent ):void
			{
				hideLoading();
				Alert.show( event.fault.faultString );
			}		
	
			private function authMe():void
			{
			
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				buzznetSrv.call( "buzznet.getOnlineNow" );
			}
			
			
			/////////////////////////////////////////////
			// API Test Calls/ All Gets
			/////////////////////////////////////////////
	
			
			private static const GET_BOOKMARKS:String 					= "buzznet.getBookmarks";	
			private static const GET_MOST_POPULAR:String 				= "buzznet.getMostPopular";
			private static const GET_TODAYS_BIRTHDAYS:String 			= "buzznet.getTodaysBirthdays";
			private static const GET_ONLINE_NOW:String 					= "buzznet.getOnlineNow";
			private static const GET_FEATURED_USERS:String 				= "buzznet.getFeaturedUsers";			
			private static const GET_GALLERY:String 					= "buzznet.getGallery";
			private static const GET_SUB_GALLERIES:String 				= "buzznet.getSubGalleries";	
			private static const GET_MY_FRIENDS:String 					= "buzznet.getMyFriends";
			private static const GET_FRIENDS:String 					= "buzznet.getFriends";
			private static const GET_FRIENDS_RECENT:String				= "buzznet.getFriendsRecent";
			private static const GET_BUZZWORD:String 					= "buzznet.getBuzzword";
			private static const BROWSE_BUZZWORDS:String 				= "buzznet.browseBuzzwords";
			private static const GET_COMMENTS:String 					= "buzznet.getComments";
			private static const GET_RECENT_COMMENTS:String 			= "buzznet.getRecentComments";
			private static const GET_RECENT_POSTS:String				= "buzznet.getRecentPosts";				

			private function sendCall( method:String, args:String = undefined ):void
			{
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				
				
				if ( !args ) 
				{
					buzznetSrv.call( method, encode );					
				} else {
					buzznetSrv.call( method, encode, args );
				}				
				
				buzznetSrv.addEventListener(ResultEvent.RESULT, onResult );
				buzznetSrv.addEventListener(FaultEvent.FAULT, onFault ); 
			}
			private function getComments():void
			{
				showLoading();
				
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				buzznetSrv.call( GET_COMMENTS, "2864741", "user" );	
			}
			private function getRecentComments():void
			{
				showLoading();
				
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				buzznetSrv.call( GET_RECENT_COMMENTS, txt_username.text );	
			}
			private function getBookmarks():void
			{
				showLoading();
				
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				buzznetSrv.call( GET_BOOKMARKS );	
			}
			private function getMyFriends():void
			{
				showLoading();
				
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				buzznetSrv.call( GET_MY_FRIENDS );	
			}
			private function getFriends():void
			{
				showLoading();
				
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				buzznetSrv.call( GET_FRIENDS, 5136771 );	
			}
			private function getMostPopular():void
			{
				showLoading();
				
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				buzznetSrv.call( GET_MOST_POPULAR, "cat" );	
			}
			private function getTodaysBirthdays():void
			{
				showLoading();
				
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				buzznetSrv.call( GET_TODAYS_BIRTHDAYS );	
			}
			private function getOnlineNow():void
			{
				showLoading();
				
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				buzznetSrv.call( GET_ONLINE_NOW );	
			}
			private function getRecentPosts():void
			{
				showLoading();
				
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				buzznetSrv.call( GET_RECENT_POSTS, "user" );	
			}
			private function getFeaturedUsers():void
			{
				showLoading();
				
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				buzznetSrv.call( GET_FEATURED_USERS, 10 );	
			}
			private function getBuzzwords():void
			{
				showLoading();
				
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				buzznetSrv.call( GET_BUZZWORD, "flex", 20, 0 );	
			}
			private function browseBuzzwords():void
			{
				showLoading();
				
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				buzznetSrv.call( BROWSE_BUZZWORDS, 50 );	
			}
			private function getGallery():void
			{
				showLoading();
				
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				buzznetSrv.call( GET_GALLERY, "ha", "user", "user", 1, 10 );	
			}
			private function getSubGalleries():void
			{
				showLoading();
				
				var encode:Base64Encoder = new Base64Encoder();
					encode.encode( txt_username.text + ":" + txt_password.text );
				
				buzznetSrv.method = "POST";
				buzznetSrv.contentType = "application/xml";
				buzznetSrv.useProxy = false;
				buzznetSrv.headers = { Authorization: "Basic " + encode, Accept: "application/xml" };
				buzznetSrv.call( GET_SUB_GALLERIES, txt_username.text );	
			}
			
			//Blogger Service Call
			private function getUserInfo():void
			{
				showLoading();
				
				bloggerSrv.call( "blogger.getUserInfo", apikey, txt_username.text, txt_password.text );
			}
			
			
			//Show the Loading Panel
			private var loadingPanel:IFlexDisplayObject;
			
			private function showLoading():void 
			{
				loadingPanel = PopUpManager.createPopUp( this, Loading, true );
			}
			private function hideLoading():void
			{
				PopUpManager.removePopUp( loadingPanel );
			}
			

		
	
   
	
   	
	
   
		
    
			
			
     
			
     
			
			
     
			
     
			
			
     
			
     			
			
     
			
     
				
      
				
      
			
     
			
     	
			
     									
		
    
		
    
		
			
     
				
      
					
       
				
      
				
      
				
      
			
     
			
			
     
				
      
				
      
				
      
				
      
				
      
				
      
				
      
			
     
			
			
     
				
      
				
      
				
      
				
      
				
      
				
      
				
      
			
     
		
    
	
   	
	
   
	
   

  
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}