home *** CD-ROM | disk | FTP | other *** search
/ Computer Active 2010 August / CA08.iso / Multimedija / shufflr.air / ShufflrClient.swf / scripts / com / facebook / views / PermissionWindow.as < prev   
Encoding:
Text File  |  2010-06-23  |  2.1 KB  |  70 lines

  1. package com.facebook.views
  2. {
  3.    import flash.events.Event;
  4.    
  5.    public class PermissionWindow extends BaseWindow
  6.    {
  7.       public static const PATH:String = "http://www.facebook.com/connect/prompt_permissions.php";
  8.       
  9.       public static const SUCCESS_PATH:String = "http://www.facebook.com/connect/login_success.html";
  10.       
  11.       public static const DEFAULT_WIDTH:Number = 640;
  12.       
  13.       public static const DEFAULT_HEIGHT:Number = 480;
  14.       
  15.       public function PermissionWindow()
  16.       {
  17.          super();
  18.          urlVars.connect_display = "popup";
  19.          urlVars.nochrome = true;
  20.          urlVars.v = "1.0";
  21.          urlVars.fbconnect = true;
  22.          urlVars.channel_url = SUCCESS_PATH;
  23.          urlVars.extern = "1";
  24.          urlVars.display = "popup";
  25.          urlVars.next = "http://www.facebook.com/connect/login_success.html?xxRESULTTOKENxx";
  26.          req.url = PATH;
  27.          distractor.text = "Loading Permissions";
  28.          distractor.x = width - distractor.width >> 1;
  29.          distractor.y = height - distractor.height >> 1;
  30.       }
  31.       
  32.       override protected function onComplete(param1:Event) : void
  33.       {
  34.          distractor.visible = false;
  35.          if(!closed)
  36.          {
  37.             width = html.width = DEFAULT_WIDTH;
  38.             height = html.height = DEFAULT_HEIGHT;
  39.             distractor.x = width - distractor.width >> 1;
  40.             distractor.y = height - distractor.height >> 1;
  41.          }
  42.       }
  43.       
  44.       public function askPermissions(param1:Array, param2:String) : void
  45.       {
  46.          urlVars.ext_perm = param1.join(",");
  47.          urlVars.api_key = param2;
  48.          html.load(req);
  49.       }
  50.       
  51.       override protected function onLocationChange(param1:Event) : void
  52.       {
  53.          if(html.location.indexOf(SUCCESS_PATH) > -1)
  54.          {
  55.             close();
  56.          }
  57.          else
  58.          {
  59.             html.width = html.height = 0;
  60.             distractor.visible = true;
  61.          }
  62.       }
  63.       
  64.       override protected function onClosing(param1:Event) : void
  65.       {
  66.       }
  67.    }
  68. }
  69.  
  70.