home *** CD-ROM | disk | FTP | other *** search
/ Computer Active 2010 August / CA08.iso / Multimedija / shufflr.air / ShufflrClient.swf / scripts / com / facebook / views / BaseWindow.as next >
Encoding:
Text File  |  2010-06-23  |  2.4 KB  |  78 lines

  1. package com.facebook.views
  2. {
  3.    import flash.display.NativeWindow;
  4.    import flash.display.NativeWindowInitOptions;
  5.    import flash.display.NativeWindowType;
  6.    import flash.display.StageAlign;
  7.    import flash.display.StageScaleMode;
  8.    import flash.events.Event;
  9.    import flash.html.HTMLLoader;
  10.    import flash.net.URLRequest;
  11.    import flash.net.URLVariables;
  12.    
  13.    public class BaseWindow extends NativeWindow
  14.    {
  15.       public static const DEFAULT_WIDTH:Number = 640;
  16.       
  17.       public static const DEFAULT_HEIGHT:Number = 480;
  18.       
  19.       public static const PADDING:Number = 20;
  20.       
  21.       protected var distractor:Distractor;
  22.       
  23.       protected var _html:HTMLLoader;
  24.       
  25.       protected var urlVars:URLVariables;
  26.       
  27.       protected var req:URLRequest;
  28.       
  29.       public function BaseWindow()
  30.       {
  31.          var _loc1_:NativeWindowInitOptions = new NativeWindowInitOptions();
  32.          _loc1_.type = NativeWindowType.UTILITY;
  33.          _loc1_.resizable = false;
  34.          _loc1_.maximizable = false;
  35.          super(_loc1_);
  36.          activate();
  37.          alwaysInFront = true;
  38.          addEventListener(Event.CLOSING,this.onClosing,false,0,true);
  39.          stage.scaleMode = StageScaleMode.NO_SCALE;
  40.          stage.align = StageAlign.TOP_LEFT;
  41.          width = DEFAULT_WIDTH;
  42.          height = DEFAULT_HEIGHT;
  43.          this._html = new HTMLLoader();
  44.          stage.addChild(this._html);
  45.          this._html.addEventListener(Event.COMPLETE,this.onComplete,false,0,true);
  46.          this._html.addEventListener(Event.LOCATION_CHANGE,this.onLocationChange,false,0,true);
  47.          this.distractor = new Distractor();
  48.          stage.addChild(this.distractor);
  49.          this.urlVars = new URLVariables();
  50.          this.req = new URLRequest();
  51.          this.req.data = this.urlVars;
  52.       }
  53.       
  54.       protected function onLocationChange(param1:Event) : void
  55.       {
  56.          this._html.width = this._html.height = 0;
  57.          this.distractor.visible = true;
  58.       }
  59.       
  60.       public function get html() : HTMLLoader
  61.       {
  62.          return this._html;
  63.       }
  64.       
  65.       protected function onComplete(param1:Event) : void
  66.       {
  67.          this.distractor.visible = false;
  68.          this._html.width = DEFAULT_WIDTH;
  69.          this._html.height = DEFAULT_HEIGHT;
  70.       }
  71.       
  72.       protected function onClosing(param1:Event) : void
  73.       {
  74.       }
  75.    }
  76. }
  77.  
  78.