home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sears Catalog 2006 Spring/Summer (French Canadian)
/
SearsCanada-AutomneEte2006-FrenchVersion-WinMac.bin
/
fr
/
howtoorderread.swf
/
scripts
/
ultimateScroller.as
< prev
Wrap
Text File
|
2005-12-06
|
39KB
|
1,324 lines
function ultimateScrollerClass()
{
this.initialize();
}
ultimateScrollerClass.prototype = new MovieClip();
ultimateScrollerClass.prototype.scrollUp = function()
{
if(this.enabled == false)
{
return undefined;
}
if(this.c_horizontal)
{
if(this.targetClip._x < this.scrollBottom)
{
var _loc4_ = this.targetClip._x + this.scrollAmount >= this.scrollBottom ? this.scrollBottom : this.targetClip._x + this.scrollAmount;
var _loc2_ = (_loc4_ - this.scrollBottom) * 100 / (this.scrollBottom - this.scrollTop) * -1;
this.drag._y = Math.floor(this.dragTop - (this.dragTop - this.dragBottom) / 100 * _loc2_);
this.syncTargetPos();
false;
false;
}
}
else if(this.targetClip._y < this.scrollTop)
{
var _loc3_ = this.targetClip._y + this.scrollAmount >= this.scrollTop ? this.scrollTop : this.targetClip._y + this.scrollAmount;
_loc2_ = (_loc3_ - this.scrollTop) * 100 / (this.scrollTop - this.scrollBottom) * -1;
this.drag._y = Math.floor(this.dragTop - (this.dragTop - this.dragBottom) / 100 * _loc2_);
this.syncTargetPos();
false;
false;
}
};
ultimateScrollerClass.prototype.scrollDown = function()
{
if(this.enabled == false)
{
return undefined;
}
if(this.c_horizontal == true)
{
if(this.targetClip._x > this.scrollTop)
{
var _loc4_ = this.targetClip._x - this.scrollAmount <= this.scrollTop ? this.scrollTop : this.targetClip._x - this.scrollAmount;
var _loc2_ = (_loc4_ - this.scrollBottom) * 100 / (this.scrollBottom - this.scrollTop) * -1;
this.drag._y = Math.ceil(this.dragTop - (this.dragTop - this.dragBottom) / 100 * _loc2_);
this.syncTargetPos();
false;
false;
}
}
else if(this.targetClip._y > this.scrollBottom)
{
var _loc3_ = this.targetClip._y - this.scrollAmount <= this.scrollBottom ? this.scrollBottom : this.targetClip._y - this.scrollAmount;
_loc2_ = (_loc3_ - this.scrollTop) * 100 / (this.scrollTop - this.scrollBottom) * -1;
this.drag._y = Math.ceil(this.dragTop - (this.dragTop - this.dragBottom) / 100 * _loc2_);
this.syncTargetPos();
false;
false;
}
};
ultimateScrollerClass.prototype.pageUp = function()
{
var _loc2_ = this.c_scrollAmount;
this.c_scrollAmount = int(this.h);
this.scrollUp();
this.c_scrollAmount = _loc2_;
false;
};
ultimateScrollerClass.prototype.pageDown = function()
{
var _loc2_ = this.c_scrollAmount;
this.c_scrollAmount = int(this.h);
this.scrollDown();
this.c_scrollAmount = _loc2_;
false;
};
ultimateScrollerClass.prototype.scrollToTop = function()
{
if(this.enabled == false)
{
return undefined;
}
this.drag._y = this.dragTop;
this.syncTargetPos();
};
ultimateScrollerClass.prototype.scrollToBottom = function()
{
if(this.enabled == false)
{
return undefined;
}
this.drag._y = this.dragBottom;
this.syncTargetPos();
};
ultimateScrollerClass.prototype.getScrollPosition = function()
{
return this.drag._y;
};
ultimateScrollerClass.prototype.setScrollPosition = function(scrollPos)
{
this.drag._y = scrollPos;
};
ultimateScrollerClass.prototype.setDragHeight = function(usrHeight)
{
this.c_dragHeight = usrHeight;
if(usrHeight > this.track_mc._height - 48)
{
usrHeight = this.track_mc._height - 48;
}
else if(usrHeight < 2)
{
usrHeight = 2;
}
this.dragHeight = usrHeight;
var btnDrag = this.attachMovie("ultimateScroller_drag","drag",5,{_x:0,_y:16,w:this.c_scrollWidth,h:this.dragHeight});
btnDrag.useHandCursor = false;
this.dragTop = 16;
this.dragBottom = this.h - 16 - this.dragHeight;
if(this.scrollTo != null)
{
btnDrag._y = this.scrollTo <= this.dragBottom ? this.scrollTo : this.dragBottom;
var _loc3_ = this.c_easing;
this.c_easing = "none";
this.syncTargetPos();
this.c_easing = _loc3_;
false;
}
btnDrag.onMouseDown = function()
{
if(this._parent.enabled == false)
{
return undefined;
}
if(btnDrag.hitTest(_level0._xmouse,_level0._ymouse))
{
btnDrag.startDrag(false,0,this._parent.dragTop,0,this._parent.dragBottom);
this._parent.dragging = true;
updateAfterEvent();
}
};
btnDrag.onMouseUp = function()
{
btnDrag.stopDrag();
this._parent.dragging = false;
updateAfterEvent();
};
if(!this.c_dragVisible)
{
this.drag._visible = false;
}
};
ultimateScrollerClass.prototype.initialize = function()
{
this.setDefaults();
this.enabled = false;
if(this.c_horizontal == true)
{
this._rotation = -90;
this._xscale = -100;
this._y = int(this._y + 16);
if(this.size == null)
{
this.setSize(this._width);
}
else
{
this.setSize(this.size);
}
}
else
{
this._rotation = 0;
this._xscale = 100;
if(this.size == null)
{
this.setSize(this._height);
}
else
{
this.setSize(this.size);
}
}
if(this._targetInstanceName.length > 0)
{
var _loc2_ = this._parent[this._targetInstanceName];
this.initX = _loc2_._x;
this.initY = _loc2_._y;
this.initW = _loc2_._width;
this.initH = _loc2_._height;
this.setTarget(_loc2_);
false;
}
else
{
this.setEnabled(false);
}
};
ultimateScrollerClass.prototype.setDefaults = function()
{
if(this.c_horizontal == null)
{
if(this.horizontal == null)
{
this.c_horizontal = false;
}
else
{
this.c_horizontal = Boolean(this.horizontal);
delete this.horizontal;
}
}
if(this.c_buffer == null)
{
if(this.buffer == null)
{
this.c_buffer = 10;
}
else
{
this.c_buffer = int(this.buffer);
delete this.buffer;
}
}
if(this.c_scrollAmount == null)
{
if(this.scrollAmount == null)
{
this.c_scrollAmount = 40;
}
else
{
this.c_scrollAmount = int(this.scrollAmount);
delete this.scrollAmount;
}
}
if(this.c_easing == null)
{
if(this.easing == null)
{
this.c_easing = "none";
}
else
{
this.c_easing = this.easing;
delete this.easing;
}
}
if(this.c_useMask == null)
{
if(this.useMask == null)
{
this.c_useMask = false;
}
else
{
this.c_useMask = Boolean(this.useMask);
delete this.useMask;
}
}
if(this.c_dragVisible == null)
{
if(this.dragVisible == null)
{
this.c_dragVisible = true;
}
else
{
this.c_dragVisible = Boolean(this.dragVisible);
delete this.dragVisible;
}
}
if(this.c_dragAuto == null)
{
if(this.dragHeightAuto == null)
{
this.c_dragAuto = true;
}
else
{
this.c_dragAuto = Boolean(this.dragHeightAuto);
delete this.dragHeightAuto;
}
}
if(this.c_scrollTrackVisible == null)
{
if(this.scrollTrackVisible == null)
{
this.c_scrollTrackVisible = true;
}
else
{
this.c_scrollTrackVisible = Boolean(this.scrollTrackVisible);
delete this.scrollTrackVisible;
}
}
if(this.c_buttonsVisible == null)
{
if(this.buttonsVisible == null)
{
this.c_buttonsVisible = true;
}
else
{
this.c_buttonsVisible = Boolean(this.buttonsVisible);
delete this.buttonsVisible;
}
}
if(this.c_arrowsVisible == null)
{
if(this.arrowsVisible == null)
{
this.c_arrowsVisible = true;