/*class scroller Powered by Kasoi(FSCA) 25.08.06 инструкцию по приминению искать на : http://fsca.ru/blog/2006/08/25/klass_scroller/ ---------- при изменения кода просьба копирайты оставлять и присылать оповещение на kasoiinc@mail.ru */ class scroller{ public var has:Boolean; private var all:MovieClip; private var tt:TextField; private var a:Object; private var b:Object; //private var sbg:MovieClip; private var th:Number; private var tw:Number; private var ty:Number; private var tx:Number; private var maxy:Number; private var miny:Number; private var sw:Number=17; private var tms:Number; private var sbgh:Number; private var sh:Number; private var pressed:Boolean; private var pressed2:Boolean; private var xm:Number; private var ym:Number; private var post:Number; public var scrol:Number; private var scrol2:Number; private var miny1:Number; private var maxy1:Number; private var scr:Number; private var q:Number; private var z:Number; public function scroller(tt,has) { this.tt=tt; scrol=tt.scroll; th=tt._height; this.has=has; init(); getSizeOfMcs(); this.pressed=false; goScroll(); } private function init():Void { this.a=tt._parent; tw=tt._width; th=tt._height-sw*2+2; ty=tt._y+sw; tx=tt._x; tms=tt.maxscroll; miny=ty; maxy=ty+th; sbgh=th } function haveScroller():Void { this.a.up.attachMovie('scroll:up','up',3); this.a.down.attachMovie('scroll:down','down',4); this.a.sbg2.attachMovie('scroll:sbg','sbg2',0); this.a.s.attachMovie('scroll:s','s',1); this.a=tt._parent; tw=tt._width; th=tt._height-this.a.up._height-this.a.down._height+2; ty=tt._y+this.a.up._height; tx=tt._x; tms=tt.maxscroll; miny=ty; maxy=ty+th+2; sbgh=th+2 this.a.sbg2._height=sbgh; this.a.sbg2._x=tx+tw; this.a.sbg2._y=ty; this.a.s._x=tx+tw; this.a.s._y=ty; this.a.up._x=tx+tw; this.a.up._y=ty-this.a.up._height; this.a.down._x=tx+tw; this.a.down._y=ty+th; } function dontHaveScroller():Void { sh=sbgh-(tms*100/th); if(sh<0){sh=sh*-1} this.a.up._x=tx+tw; this.a.up._y=ty-sw; this.a.up.test.enabled=false; this.a.up.beginFill(0x999999,40) this.a.up.lineStyle(1,0,40); this.a.up.lineTo(sw,0); this.a.up.lineTo(sw,sw); this.a.up.lineTo(0,sw); this.a.up.lineTo(0,0); this.a.up.endFill(); this.a.up.lineStyle(2,0,40) this.a.up.moveTo(sw/1.2,sw/1.2); this.a.up.lineTo(sw/2,sw/2) this.a.up.lineTo(sw-sw/1.2,sw/1.2) this.a.down._x=tx+tw; this.a.down._y=maxy; this.a.down.beginFill(0x999999,40) this.a.down.lineStyle(1,0,40); this.a.down.lineTo(sw,0); this.a.down.lineTo(sw,sw); this.a.down.lineTo(0,sw); this.a.down.lineTo(0,0); this.a.down.endFill(); this.a.down.lineStyle(2,0,40) this.a.down.moveTo(sw/1.2,sw-sw/1.2); this.a.down.lineTo(sw/2,sw/1.5) this.a.down.lineTo(sw-sw/1.2,sw-sw/1.2) this.a.sbg2._x=tx+tw; this.a.sbg2._y=ty; this.a.sbg2.beginFill(0xf1f1f1,50); this.a.sbg2.lineStyle(1,0,20); this.a.sbg2.lineTo(sw,0); this.a.sbg2.lineTo(sw,th); this.a.sbg2.lineTo(0,th); this.a.sbg2.lineTo(0,0); this.a.sbg2.endFill(); this.a.s._x=tx+tw+1; this.a.s._y=ty; this.a.s.beginFill(0x666666,80); this.a.s.lineStyle(1,0,40); this.a.s.moveTo(0,5); this.a.s.curveTo(7,0,sw-1,5); this.a.s.lineTo(sw-1,sh); this.a.s.curveTo(7,sh+5,0,sh) this.a.s.lineTo(0,5); this.a.s.endFill(); } public function getSizeOfMcs():Void { this.a.createEmptyMovieClip('s',1); this.a.createEmptyMovieClip('sbg2',0); this.a.createEmptyMovieClip('mcx',2); this.a.createEmptyMovieClip('up',3); this.a.createEmptyMovieClip('down',4); if(this.has==true){ haveScroller(); } else{ if(th<30){ }else { dontHaveScroller() } } } public function goScroll():Void { var mc:MovieClip=this.a.mcx; var s:MovieClip=this.a.s; var tx:TextField=this.a.tt; var sbg:MovieClip=this.a.sbg2; var up:MovieClip=this.a.up; var down:MovieClip=this.a.down; up.onPress=function() { tx.scroll=tx.scroll-3; mc.scrol2=-3; mc.pressed2=true; scr=(tx.scroll/tx.maxscroll*100)*((sbg._height-s._height)/100); s._y=scr+mc.miny; if(s._y>mc.maxy){s._y=mc.maxy} if(s._ymc.maxy){s._y=mc.maxy} if(s._y10){ q++; if(q==5){ tx.scroll=tx.scroll+scrol2; scr=(tx.scroll/tx.maxscroll*100)*((sbg._height-s._height)/100); s._y=scr+mc.miny; if(s._y>mc.maxy){s._y=mc.maxy} if(s._ymaxy){s._y=maxy;} tx.scroll=(tx.maxscroll/100)*(((s._y-miny)/(maxy-miny))*100) if(miny1!=miny){miny=tx._y;miny1=miny;} if(maxy1!=maxy){maxy=tx._y+tx._height-1;trace('изменён размер');maxy1=maxy;} } if(pressed==false){ } } } }