home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PCGUIA 2010 Software/Programs
/
PCGuia_programas.iso
/
Swf
/
linux.swf
/
scripts
/
__Packages
/
com
/
rightactionscript
/
fcb
/
components
/
ScrollPane.as
< prev
next >
Wrap
Text File
|
2010-02-24
|
6KB
|
174 lines
class com.rightactionscript.fcb.components.ScrollPane extends com.rightactionscript.fcb.components.UIBasicComponent
{
function ScrollPane()
{
super();
}
function set scaleTo(oScaleTo)
{
this._oScaleTo = oScaleTo;
}
function get bytesLoaded()
{
return this._ldrContent.__get__bytesLoaded();
}
function get bytesTotal()
{
return this._ldrContent.__get__bytesTotal();
}
function get percentLoaded()
{
var _loc2_ = Math.round(this.__get__bytesLoaded() / this.__get__bytesTotal() * 100);
_loc2_ = !isNaN(_loc2_) ? _loc2_ : 0;
return _loc2_;
}
function init()
{
super.init();
}
function createChildren()
{
super.createChildren();
this.createEmptyMovieClip("_mcFrame",this.getNextHighestDepth());
this.attachMovie("Loader","_ldrContent",this.getNextHighestDepth());
this.attachMovie("ScrollBar","_sbVertical",this.getNextHighestDepth());
this.attachMovie("ScrollBar","_sbHorizontal",this.getNextHighestDepth());
this.createEmptyMovieClip("_mcMask",this.getNextHighestDepth());
this._sbVertical.setScrollProperties(10,0,100);
this._sbVertical.setSize(null,100 - this._sbVertical._width);
this._sbHorizontal.setScrollProperties(10,0,100);
this._sbHorizontal.setSize(null,100 - this._sbHorizontal._width);
this._sbHorizontal.__set__horizontal(true);
if(this.__width == undefined || this.__width == 0)
{
this.setSize(100,100);
}
this._ldrContent.__set__scaleContent(false);
this._ldrContent.addEventListener("complete",this);
this._ldrContent.__set__autoLoad(false);
if(this._sURL != undefined)
{
this.load();
}
this.mcBoundingBox._visible = false;
this.mcBoundingBox._width = 0;
this.mcBoundingBox._height = 0;
}
function draw()
{
var _loc3_ = this.__width - this._sbVertical._width;
var _loc2_ = this.__height - this._sbHorizontal._height;
this._mcMask.clear();
this._mcMask.lineStyle(0,0,0);
this._mcMask.beginFill(0,0);
this._mcMask.lineTo(_loc3_,0);
this._mcMask.lineTo(_loc3_,_loc2_);
this._mcMask.lineTo(0,_loc2_);
this._mcMask.lineTo(0,0);
this._mcMask.endFill(0);
this._mcFrame.clear();
this._mcFrame.lineStyle(0,15790065,100);
this._mcFrame.beginFill(16777215,100);
this._mcFrame.lineTo(this.__width - 1,0);
this._mcFrame.lineTo(this.__width - 1,this.__height - 1);
this._mcFrame.lineTo(0,this.__height - 1);
this._mcFrame.lineTo(0,0);
this._mcFrame.endFill();
}
function arrange()
{
this._sbVertical.setSize(null,this.__height - this._sbVertical._width);
this._sbHorizontal.setSize(null,this.__width - this._sbHorizontal._height);
this._sbVertical._x = this.__width - this._sbVertical._width;
this._sbHorizontal._y = this.__height;
}
function size()
{
super.size();
this.draw();
this.arrange();
}
function scroll(oEvent)
{
if(oEvent.target == this._sbHorizontal)
{
this._ldrContent._x = - oEvent.target.scrollPosition;
}
if(oEvent.target == this._sbVertical)
{
this._ldrContent._y = - oEvent.target.scrollPosition;
}
}
function complete(oEvent)
{
var _loc5_ = this.__height / oEvent.target._height;
var _loc6_ = this.__width / oEvent.target._width;
var _loc4_ = oEvent.target._width - this.__width;
var _loc3_ = oEvent.target._height - this.__height;
this._sbHorizontal.setScrollProperties(_loc6_ * _loc4_,0,_loc4_);
this._sbHorizontal.addEventListener("scroll",this);
this._sbVertical.setScrollProperties(_loc5_ * _loc3_,0,_loc3_);
this._sbVertical.addEventListener("scroll",this);
if(oEvent.target._width == 0)
{
oEvent.target.contentPath = "ScrollPaneSimpleFill";
oEvent.target.load();
}
oEvent.target.setMask(this._mcMask);
this.dispatchEvent({type:"complete",target:this});
}
function set contentPath(sURL)
{
this._sURL = sURL;
if(this._ldrContent != undefined)
{
this.load();
}
}
function set scrollContent(mcContent)
{
if(typeof mcContent == "string")
{
mcContent = eval(mcContent);
}
this._mcContent = mcContent;
this.load();
}
function get content()
{
return this._ldrContent.__get__content();
}
function load()
{
if(this._mcContent instanceof MovieClip)
{
this._mcContent._x = this._x;
this._mcContent._y = this._y;
}
else
{
if(this._sURL == "EmptyMovieClip")
{
this._sURL = "ScrollPaneSimpleFill";
}
this._ldrContent.__set__contentPath(this._sURL);
this._ldrContent.load();
this._ldrContent.addEventListener("complete",this);
this._ldrContent.addEventListener("progress",this);
}
}
function progress(oEvent)
{
this.dispatchEvent({type:"progress",target:this});
}
function refreshPane()
{
var _loc4_ = this.__height / this._ldrContent._height;
var _loc5_ = this.__width / this._ldrContent._height;
var _loc3_ = this._ldrContent._height - this.__width + this._sbVertical._width;
var _loc2_ = this._ldrContent._height - this.__height + this._sbHorizontal._height;
this._sbHorizontal.setScrollProperties(_loc5_ * _loc3_,0,_loc3_);
this._sbVertical.setScrollProperties(_loc4_ * _loc2_,0,_loc2_);
}
}