?? gorizscrollpanel.as
字號:
?//***********************GorizScrollPanel class*************************
import pssclasses.splitpanel.scrollpane.*;
class GorizScrollPanel extends ScrollBasicAction {
//**************define metods****************
private function GorizScrollPanel() {
//*******************transform from vertical to gorizontal scroll***********************
__this._rotation -= 90;
__this._xscale *= -1;
//*****end***********transform from vertical to gorizontal scroll***********************
}
//****************************WATCH ON CONTENT********************
public function scrollBGSetSize(__size:Number):Void {
scrollBG_mc._height = __size;
// scroll bg
center_mc._y = Math.floor(top_mc._height)-2;
center_mc._height = Math.floor(__size-top_mc._height*2)+3;
bott_mc._y = Math.floor(__size-bott_mc._height);
//set SIZEORIENTIR for watch scroll
SIZEORIENTIR = __size;
//watch content
watchContent();
}
//************************SET CONTENT MOVIE AND CALL FUNCTION scrolingEventContent()
public function set contentContainer(cont:MovieClip):Void {
CONTENT = cont;
//*****************when press**************
scrolingEventContent();
}
public function watchContent():Void {
//*******************resize scroll bulb**********************
// border when goriz scroll is visible
var gorScrollHeight:Number = Math.ceil(__this._width);
// content height
var contHeight:Number = CONTENT._width+Balance;
// contenc tail
//SIZEORIENTIR = scroll BG height
var diferentH:Number = contHeight-SIZEORIENTIR;
// start scroll bulb size
var bulbSize:Number = SIZEORIENTIR;
// bulb size
bulbSize = Math.round(bulbSize-diferentH);
// scroll height - scroll height
var scrollWay:Number = SIZEORIENTIR-scrollBulb_mc._height;
//****************************visible scroll*******************
if (contHeight<SIZEORIENTIR) {
__this._visible = false;
SCROLLPANE.gScrollVisible = false;
} else {
__this._visible = true;
SCROLLPANE.gScrollVisible = true;
// set bulb size
bulbSetSize(bulbSize);
}
// if scroll y and height > scroll bg
if (SIZEORIENTIR<scrollBulb_mc._y+scrollBulb_mc._height) {
scrollBulb_mc._y -= scrollBulb_mc._y+scrollBulb_mc._height-SIZEORIENTIR;
}
// content place
if (diferentH<=-(CONTENT._x) && CONTENT._x<0) {
CONTENT._x = -(diferentH);
}
if (CONTENT._x>0) {
CONTENT._x = 0;
}
// percent content tail
var percentContentPosition:Number = Math.round(-(CONTENT._x)/diferentH*100);
// pixel from content tail percent for bulb position
var percentBulbPosition:Number = Math.round((SIZEORIENTIR-scrollBulb_mc._height)/100*percentContentPosition);
// bulb place
scrollBulb_mc._y = percentBulbPosition;
}
//********************************SCROLING*******************************
private function scrolingEventContent():Void {
var scrollFull:MovieClip = __this;
var scrollPane:MovieClip = __this._parent;
var _CONTENT:MovieClip = CONTENT;
var maxPoint:Number = 0;
var pointClik:Number = 0;
var __bulb:MovieClip = scrollBulb_mc;
var diferent:Number;
var ziroPosition:Number;
var percentBulbPosition:Number;
var percentContentPosition:Number;
var scrollWay:Number;
var _Balance:Number = Balance;
//***********************scroll content*******************
function scrollContent():Void {
//*******************cointainer for scroll bulb**************************
__bulb._y = scrollFull._ymouse-pointClik;
if (__bulb._y<=1) {
__bulb._y = 1;
}
if (__bulb._y+__bulb._height>=maxPoint) {
__bulb._y = maxPoint-__bulb._height-1;
}
//****end*************cointainer for scroll bulb**************************
//**************scroling process
//*******calculate percent scroll bulb position and how much pixel this percent from deferent size********
percentBulbPosition = Math.round(__bulb._y/scrollWay*100);
// percent scroll bulb position to pixcel for content position
percentContentPosition = Math.round(diferent/100*percentBulbPosition);
// ********end calculate***********
_CONTENT._x = -(percentContentPosition);
//****end*******scroling process
updateAfterEvent();
}
//*****end***************scroll content*******************
scrollBulb_mc.onPress = function() {
//poind clik on bulb
pointClik = scrollFull._ymouse-this._y;
maxPoint = scrollFull.scrollBG_mc._height;
diferent = _CONTENT._width-scrollFull._width+_Balance;
ziroPosition = Math.round(__bulb._height);
scrollWay = maxPoint-ziroPosition;
// set interval
INTERINDEX = setInterval(scrollContent, 5);
//this.onMouseMove = scrollContent;
};
//*********************************KEY EVENT*********************
// browser if activ
var _BROWSER:MovieClip = BROWSER;
var keyListener:Object = new Object();
Key.addListener(keyListener);
keyListener.onKeyDown = function() {
if (Key.getCode() == Key.LEFT || Key.getCode() == Key.RIGHT) {
if (_BROWSER.ActivBrowser) {
//poind clik on bulb
pointClik = scrollFull._ymouse-this._y;
maxPoint = scrollFull.scrollBG_mc._height;
diferent = _CONTENT._width-scrollFull._width+_Balance;
ziroPosition = Math.round(__bulb._height);
scrollWay = maxPoint-ziroPosition;
//**************************DOWN*************************************
if (Key.getCode() == Key.LEFT) {
__bulb._y -= 5;
}
//**************************UP*************************************
if (Key.getCode() == Key.RIGHT) {
__bulb._y += 5;
}
//**************scroling process
//*****************cointainer for scroll bulb**************************
if (__bulb._y<=1) {
__bulb._y = 1;
}
if (__bulb._y+__bulb._height>=maxPoint) {
__bulb._y = maxPoint-__bulb._height-1;
}
//****end*************cointainer for scroll bulb**************************
//*******calculate percent scroll bulb position and how much pixel this percent from deferent size********
percentBulbPosition = Math.round(__bulb._y/scrollWay*100);
// percent scroll bulb position to pixcel for content position
percentContentPosition = Math.round(diferent/100*percentBulbPosition);
// ********end calculate***********
_CONTENT._x = -(percentContentPosition);
//****end*******scroling process
updateAfterEvent();
}
}
};
//***********END*****************KEY EVENT*********************
}
//*******end*********************SCROLING*******************************
//*******end***class*****************
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -