Example code

<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 
    width="384" height="311" applicationComplete="init()" 
    viewSourceURL="srcview/index.html"> 
    <mx:Button x="110.5" y="44" label="Connect To Facebook" 
    id="connectBtn"  click="onConnectBtnClick()" width="163"/> 
    <mx:Label x="110.5" y= "88" id="label1" width="163" height="51"/> 
    <mx:Image x="136.5" y=" 147" id="image" width="111 " height="118"/> 
    <mx:Script> 
        <![CDATA[ 
            // Step 2 - Define a configuration object. Insert your API Key below: 
            private var conf:Object = { 
                 APIKey: 'Put Your  APIKey   here', 
                enabledProviders: '*' 
            }     
            // This method is executed on application Complete                 
            import com.adobe.fps; 
            private function init():void { 
                connectBtn.enabled = false; 
                 label1.text = 'Loading Social...'; 
                 
                // Initialize the "mcRoot" attribute of the conf object - should 
                refer to the root of the flash container. 
                this.conf.mcRoot=this.root; 
                  
                // Step 3 - Load Social service 
                 // 3.1 Create the load-parameters object 
                var loadParams:Object = { 
                    services:'socialize', 
                    callback:onServiceLoad 
                } 
                 
                // 3.1 Load the services 
                 fps.load(conf,loadParams);                 
            } 
             
            // 3.2 Wait for the load to complete and handle failures/success 
            private function onServiceLoad(response :*):void { 
                if (response.hadError) { 
                    // handle failure 
                    label1.text = 'An error has occurred while attempting to load 
                    Social service'; 
                } else { 
                    label1.text = ''; 
                     connectBtn.enabled = true;    
                } 
            } 
             
            private function onConnectBtnClick(): void { 
                  // Step 4 - Define parameters object: 
                 var connectParams:Object = { 
                     callback: onConnect, 
                     provider: 'facebook' 
         
                 };   
       
                 // Step 5 - Calling the Social API method - connect: 
                 fps.services.socialize.connect(conf, connectParams); 
            } 
             
            // Step 6 - Define callback function: 
            private function onConnect(response: Object): void  { 
                if (response.status=='OK') 
                { 
                    // inject the user's nickname to the label 
                     label1.text = response.user.nickname; 
                    // inject the user's photo to the image "source" attribute. 
                     image.source=response.user.photoURL; 
                 } else { 
                    //handle errors 
                    label1.text = "An error has occurred!" + '\n' + 
                            "Error details: " + response.statusMessage + '\n' + 
                             "In method:   " + response.operation; 
                } 
             
            } 
        ]]> 
    </mx:Script> 
</mx:Application>