home *** CD-ROM | disk | FTP | other *** search
/ Hentai Interactivo 52 / HENTAI52.bin / flip2.swf / scripts / __Packages / mx / containers / ScrollPane.as
Text File  |  2008-09-03  |  9KB  |  272 lines

  1. class mx.containers.ScrollPane extends mx.core.ScrollView
  2. {
  3.    static var symbolName = "ScrollPane";
  4.    static var symbolOwner = mx.containers.ScrollPane;
  5.    var className = "ScrollPane";
  6.    static var version = "2.0.2.127";
  7.    var __hScrollPolicy = "auto";
  8.    var __scrollDrag = false;
  9.    var __vLineScrollSize = 5;
  10.    var __hLineScrollSize = 5;
  11.    var __vPageScrollSize = 20;
  12.    var __hPageScrollSize = 20;
  13.    var clipParameters = {contentPath:1,scrollDrag:1,hScrollPolicy:1,vScrollPolicy:1,vLineScrollSize:1,hLineScrollSize:1,vPageScrollSize:1,hPageScrollSize:1};
  14.    static var mergedClipParameters = mx.core.UIObject.mergeClipParameters(mx.containers.ScrollPane.prototype.clipParameters,mx.core.ScrollView.prototype.clipParameters);
  15.    var initializing = true;
  16.    function ScrollPane()
  17.    {
  18.       super();
  19.    }
  20.    function getBytesTotal()
  21.    {
  22.       return this._total;
  23.    }
  24.    function getBytesLoaded()
  25.    {
  26.       return this._loaded;
  27.    }
  28.    function set contentPath(scrollableContent)
  29.    {
  30.       if(!this.initializing)
  31.       {
  32.          if(scrollableContent == undefined)
  33.          {
  34.             this.destroyChildAt(0);
  35.          }
  36.          else
  37.          {
  38.             if(this[mx.core.View.childNameBase + 0] != undefined)
  39.             {
  40.                this.destroyChildAt(0);
  41.             }
  42.             this.createChild(scrollableContent,"spContentHolder");
  43.          }
  44.       }
  45.       this.__scrollContent = scrollableContent;
  46.    }
  47.    function get contentPath()
  48.    {
  49.       return this.__scrollContent;
  50.    }
  51.    function get content()
  52.    {
  53.       return this.spContentHolder;
  54.    }
  55.    function setHPosition(position)
  56.    {
  57.       if(position <= this.hScroller.maxPos && position >= this.hScroller.minPos)
  58.       {
  59.          super.setHPosition(position);
  60.          this.spContentHolder._x = - position;
  61.       }
  62.    }
  63.    function setVPosition(position)
  64.    {
  65.       if(position <= this.vScroller.maxPos && position >= this.vScroller.minPos)
  66.       {
  67.          super.setVPosition(position);
  68.          this.spContentHolder._y = - position;
  69.       }
  70.    }
  71.    function get vLineScrollSize()
  72.    {
  73.       return this.__vLineScrollSize;
  74.    }
  75.    function set vLineScrollSize(vLineSize)
  76.    {
  77.       this.__vLineScrollSize = vLineSize;
  78.       this.vScroller.__set__lineScrollSize(vLineSize);
  79.    }
  80.    function get hLineScrollSize()
  81.    {
  82.       return this.__hLineScrollSize;
  83.    }
  84.    function set hLineScrollSize(hLineSize)
  85.    {
  86.       this.__hLineScrollSize = hLineSize;
  87.       this.hScroller.__set__lineScrollSize(hLineSize);
  88.    }
  89.    function get vPageScrollSize()
  90.    {
  91.       return this.__vPageScrollSize;
  92.    }
  93.    function set vPageScrollSize(vPageSize)
  94.    {
  95.       this.__vPageScrollSize = vPageSize;
  96.       this.vScroller.__set__pageScrollSize(vPageSize);
  97.    }
  98.    function get hPageScrollSize()
  99.    {
  100.       return this.__hPageScrollSize;
  101.    }
  102.    function set hPageScrollSize(hPageSize)
  103.    {
  104.       this.__hPageScrollSize = hPageSize;
  105.       this.hScroller.__set__pageScrollSize(hPageSize);
  106.    }
  107.    function set hScrollPolicy(policy)
  108.    {
  109.       this.__hScrollPolicy = policy.toLowerCase();
  110.       this.setScrollProperties(this.spContentHolder._width,1,this.spContentHolder._height,1);
  111.    }
  112.    function set vScrollPolicy(policy)
  113.    {
  114.       this.__vScrollPolicy = policy.toLowerCase();
  115.       this.setScrollProperties(this.spContentHolder._width,1,this.spContentHolder._height,1);
  116.    }
  117.    function get scrollDrag()
  118.    {
  119.       return this.__scrollDrag;
  120.    }
  121.    function set scrollDrag(s)
  122.    {
  123.       this.__scrollDrag = s;
  124.       if(this.__scrollDrag)
  125.       {
  126.          this.spContentHolder.useHandCursor = true;
  127.          this.spContentHolder.onPress = function()
  128.          {
  129.             this._parent.startDragLoop();
  130.          };
  131.          this.spContentHolder.tabEnabled = false;
  132.          this.spContentHolder.onRelease = this.spContentHolder.onReleaseOutside = function()
  133.          {
  134.             delete this.onMouseMove;
  135.          };
  136.          this.__scrollDrag = true;
  137.       }
  138.       else
  139.       {
  140.          delete this.spContentHolder.onPress;
  141.          this.spContentHolder.tabEnabled = false;
  142.          this.spContentHolder.tabChildren = true;
  143.          this.spContentHolder.useHandCursor = false;
  144.          this.__scrollDrag = false;
  145.       }
  146.    }
  147.    function init(Void)
  148.    {
  149.       super.init();
  150.       this.tabEnabled = true;
  151.       this.keyDown = this._onKeyDown;
  152.    }
  153.    function createChildren(Void)
  154.    {
  155.       super.createChildren();
  156.       this.mask_mc._visible = false;
  157.       this.initializing = false;
  158.       if(this.__scrollContent != undefined && this.__scrollContent != "")
  159.       {
  160.          this.__set__contentPath(this.__scrollContent);
  161.       }
  162.    }
  163.    function size(Void)
  164.    {
  165.       super.size();
  166.       this.setScrollProperties(this.spContentHolder._width,1,this.spContentHolder._height,1);
  167.       this.hPosition = Math.min(this.hPosition,this.__get__maxHPosition());
  168.       this.vPosition = Math.min(this.vPosition,this.__get__maxVPosition());
  169.    }
  170.    function setScrollProperties(columnCount, columnWidth, rowCount, rowHeight)
  171.    {
  172.       super.setScrollProperties(columnCount,columnWidth,rowCount,rowHeight);
  173.       this.hScroller.__set__lineScrollSize(this.__hLineScrollSize);
  174.       this.hScroller.__set__pageScrollSize(this.__hPageScrollSize);
  175.       this.vScroller.__set__lineScrollSize(this.__vLineScrollSize);
  176.       this.vScroller.__set__pageScrollSize(this.__vPageScrollSize);
  177.    }
  178.    function onScroll(scrollEvent)
  179.    {
  180.       this.spContentHolder._x = - this.__hPosition;
  181.       this.spContentHolder._y = - this.__vPosition;
  182.       super.onScroll(scrollEvent);
  183.    }
  184.    function childLoaded(obj)
  185.    {
  186.       super.childLoaded(obj);
  187.       this.onComplete();
  188.    }
  189.    function onComplete(Void)
  190.    {
  191.       this.setScrollProperties(this.spContentHolder._width,1,this.spContentHolder._height,1);
  192.       this.hPosition = 0;
  193.       this.vPosition = 0;
  194.       this.__set__scrollDrag(this.__scrollDrag);
  195.       this.invalidate();
  196.    }
  197.    function startDragLoop(Void)
  198.    {
  199.       this.spContentHolder.lastX = this.spContentHolder._xmouse;
  200.       this.spContentHolder.lastY = this.spContentHolder._ymouse;
  201.       this.spContentHolder.onMouseMove = function()
  202.       {
  203.          var _loc5_ = this.lastX - this._xmouse;
  204.          var _loc4_ = this.lastY - this._ymouse;
  205.          _loc5_ += this._parent.hPosition;
  206.          _loc4_ += this._parent.vPosition;
  207.          var _loc3_ = this._parent.getViewMetrics();
  208.          var _loc7_ = this._parent.__height - _loc3_.top - _loc3_.bottom;
  209.          var _loc6_ = this._parent.__width - _loc3_.left - _loc3_.right;
  210.          this._parent.__hPosition = Math.max(0,Math.min(_loc5_,this._width - _loc6_));
  211.          this._parent.__vPosition = Math.max(0,Math.min(_loc4_,this._height - _loc7_));
  212.          this._parent.hScroller.scrollPosition = this._parent.__hPosition;
  213.          this._x = - this._parent.hPosition;
  214.          this._parent.vScroller.scrollPosition = this._parent.__vPosition;
  215.          this._y = - this._parent.vPosition;
  216.          super.dispatchEvent({type:"scroll"});
  217.       };
  218.    }
  219.    function dispatchEvent(o)
  220.    {
  221.       o.target = this;
  222.       this._total = o.total;
  223.       this._loaded = o.current;
  224.       super.dispatchEvent(o);
  225.    }
  226.    function refreshPane(Void)
  227.    {
  228.       this.__set__contentPath(this.__scrollContent);
  229.    }
  230.    function _onKeyDown(e)
  231.    {
  232.       if(this.hScroller != undefined && this.__hPosition <= this.hScroller.maxPos && this.__hPosition >= this.hScroller.minPos)
  233.       {
  234.          if(e.code == 37)
  235.          {
  236.             this.hPosition -= this.hLineScrollSize;
  237.          }
  238.          else if(e.code == 39)
  239.          {
  240.             this.hPosition += this.hLineScrollSize;
  241.          }
  242.       }
  243.       if(this.vScroller != undefined && this.__vPosition <= this.vScroller.maxPos && this.__vPosition >= this.vScroller.minPos)
  244.       {
  245.          if(e.code == 33)
  246.          {
  247.             this.vPosition -= this.vPageScrollSize;
  248.          }
  249.          else if(e.code == 34)
  250.          {
  251.             this.vPosition += this.vPageScrollSize;
  252.          }
  253.          if(e.code == 40)
  254.          {
  255.             this.vPosition += this.vLineScrollSize;
  256.          }
  257.          else if(e.code == 38)
  258.          {
  259.             this.vPosition -= this.vLineScrollSize;
  260.          }
  261.       }
  262.       if(e.code == 36)
  263.       {
  264.          this.vPosition = this.vScroller.minPos;
  265.       }
  266.       else if(e.code == 35)
  267.       {
  268.          this.vPosition = this.vScroller.maxPos;
  269.       }
  270.    }
  271. }
  272.