00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 import mx.xpath.XPathAPI;
00011 import amg.*;
00012
00013 class amg.ThumbnailView extends MovieClip {
00014
00015 private var _bSmartLoad:Boolean = true;
00016 private var _iSmartLoaderIndex:Number = 0;
00017 private var _iSmartLoaderCount:Number = 0;
00018 private var _iLoadingClip:Number = -1;
00019 public var bLoadingComplete:Boolean;
00020 private var _iXmlGroupChunkIndex:Number = Number.MAX_VALUE;
00021
00022
00023 private var ThumbnailCanvas:MovieClip;
00024 private var ThumbnailCanvasMask:MovieClip;
00025 private var ThumbnailViewBg:MovieClip;
00026 private var ThumbnailControls:MovieClip;
00027 private var ScrollBtnLeft:MovieClip;
00028 private var ScrollBtnRight:MovieClip;
00029 private var ScrollBtnUp:MovieClip;
00030 private var ScrollBtnDown:MovieClip;
00031 private var ScrollLine:MovieClip;
00032 private var ScrollThumb:MovieClip;
00033 private var ScrollBarBg:MovieClip;
00034 private var ScrollThumbBotCap:MovieClip;
00035
00036 private var _bScrollUsed:Boolean;
00037 private var _iScrollDistance:Number;
00038 private var _thumbnailOffset:Number = 0;
00039
00040
00041 private var _aThumbClips:Array;
00042 public var _strViewMode:String;
00043 private var _iControlWidth:Number;
00044 private var _iControlHeight:Number;
00045 private var _iCurrentPage:Number = 1;
00046 private var _iThumbsPerPage:Number;
00047 private var _iTotalPages:Number;
00048 private var _iStartThumb:Number;
00049 private var _iEndThumb:Number;
00050 private var _iCurrentThumb:Number;
00051 private var _strBaseRefUrl:String;
00052
00053
00054 public var ThumbnailNextPageTip:String ="";
00055 public var ThumbnailPrevPageTip:String ="";
00056 public var ThumbnailLastPageTip:String ="";
00057 public var ThumbnailFirstPageTip:String ="";
00058
00059
00060 private var _bDropShadows:Boolean = true;
00061 private var _iThumbnailViewBg:Number = 0xd0d7e0;
00062 private var _iThumbnailViewBgAlpha:Number = 0;
00063 private var _iThumbnailViewBorder:Number = 0xd0d7e0;
00064 private var _iThumbnailViewBorderAlpha = 0;
00065 private var _iThumbClipBorderColor:Number = 0xffffff;
00066 private var _iThumbClipBorderAlpha:Number = 100;
00067 private var _iThumbClipBorderWidth:Number = 3;
00068 private var _iThumbClipHover:Number = 0x7890ac;
00069 private var _iThumbClipHoverAlpha:Number = 100;
00070 private var _iThumbClipSelected:Number = 0xff0000;
00071 private var _iThumbClipSelectedAlpha:Number = 100;
00072 private var _iScrollBarBorder:Number = 0x333333;
00073 private var _iScrollBarBorderAlpha:Number = 100;
00074 private var _iScrollBarFill:Number = 0xdddddd;
00075 private var _iScrollBarFillAlpha:Number = 100;
00076
00077 private var _iThumbControlTopSpacer:Number = 15;
00078 private var _iPaginationButtonsBottomSpacer:Number = 7;
00079 private var _iScrollBarMargin:Number = 6;
00080 private var _iTabIndex:Number;
00081
00082
00083 private var _iThumbClipMaxWidth:Number = 72;
00084 private var _iThumbClipMaxHeight:Number = 54;
00085 private var _iThumbClipRightMargin:Number = 33;
00086 private var _iThumbClipLeftMargin:Number = 12;
00087 private var _iThumbClipBottomMargin:Number = 18;
00088
00089 public function ThumbnailView(){
00090 this.ThumbnailViewBg = this.attachMovie("ThumbnailViewBg","background",this.getNextHighestDepth());
00091 this.ThumbnailCanvas = this.createEmptyMovieClip("thumbCanvas",this.getNextHighestDepth());
00092 this._iControlWidth = this._width;
00093 this._aThumbClips = new Array();
00094 this._iCurrentThumb = 0;
00095 }
00096
00097
00098 public function initView(viewMode:String,baseRefUrl:String,p_tabIndex:Number){
00099 this._iTabIndex = p_tabIndex;
00100 this._strViewMode = viewMode;
00101 this._strBaseRefUrl = baseRefUrl;
00102 this.ThumbnailControls.removeMovieClip();
00103 this.ScrollBtnLeft.removeMovieClip();
00104 this.ScrollBtnRight.removeMovieClip();
00105 this.ScrollBtnUp.removeMovieClip();
00106 this.ScrollBtnDown.removeMovieClip();
00107 this.ScrollLine.removeMovieClip();
00108 this.ScrollThumb.removeMovieClip();
00109
00110
00111
00112 if((_strViewMode == "galleryDefault")||(_strViewMode == "slideshowDefault")){
00113 this.ThumbnailControls = this.attachMovie("ThumbnailControls","thumbControls",this.getNextHighestDepth());
00114 this.ThumbnailControls._x = (this._iControlWidth/2)-(this.ThumbnailControls._width/2);
00115 }
00116 else if ((_strViewMode == "galleryScrollingBottom")||(_strViewMode == "gallerySideMetadata")){
00117 this.ThumbnailCanvasMask = this.createEmptyMovieClip("mask",this.getNextHighestDepth());
00118 this.ScrollBtnLeft = this.attachMovie("ScrollBtnLeft","ScrollBtnLeft",this.getNextHighestDepth());
00119 this.ScrollBtnLeft.tabIndex = this._iTabIndex+ 1000;
00120 this.ScrollBtnLeft.fieldName = "ThumbnailView";
00121 this.ScrollBtnRight = this.attachMovie("ScrollBtnRight","ScrollBtnRight",this.getNextHighestDepth());
00122 this.ScrollBtnRight.fieldName = "ThumbnailView";
00123 this.ScrollBtnRight.tabIndex = this._iTabIndex + 1001;
00124 this.ScrollBarBg = this.createEmptyMovieClip("mask",this.getNextHighestDepth());
00125 this.ScrollLine = this.attachMovie("ScrollLineHoriz","ScrollLine",this.getNextHighestDepth());
00126 this.ScrollThumb = this.attachMovie("ScrollThumb","ScrollThumb",this.getNextHighestDepth());
00127 this.ScrollThumb.init("horizontal");
00128 this.ScrollThumb.onPress = scrollThumbDrag;
00129 this.ScrollThumb.onRelease = scrollThumbStopDrag;
00130 this.ScrollThumb.onReleaseOutside = scrollThumbStopDrag;
00131
00132
00133 }
00134 else if (_strViewMode == "galleryScrollingLeft"){
00135 this.ThumbnailCanvasMask = this.createEmptyMovieClip("mask",this.getNextHighestDepth());
00136 this.ScrollBtnUp = this.attachMovie("ScrollBtnUp","ScrollBtnUp",this.getNextHighestDepth());
00137 this.ScrollBtnUp.fieldName = "ThumbnailView";
00138 this.ScrollBtnUp.tabIndex = this._iTabIndex+ 1000;
00139 this.ScrollBtnDown = this.attachMovie("ScrollBtnDown","ScrollBtnDown",this.getNextHighestDepth());
00140 this.ScrollBtnDown.fieldName = "ThumbnailView";
00141 this.ScrollBtnDown.tabIndex = this._iTabIndex+ 1001;
00142
00143 this.ScrollBarBg = this.createEmptyMovieClip("mask",this.getNextHighestDepth());
00144 this.ScrollLine = this.attachMovie("ScrollLine","ScrollLine",this.getNextHighestDepth());
00145 this.ScrollThumb = this.attachMovie("ScrollThumb","ScrollThumb",this.getNextHighestDepth());
00146 this.ScrollThumb.init("vertical");
00147 this.ScrollThumb.onPress = scrollThumbDrag;
00148 this.ScrollThumb.onRelease = scrollThumbStopDrag;
00149 this.ScrollThumb.onReleaseOutside = scrollThumbStopDrag;
00150
00151
00152 }
00153 }
00154
00155
00156
00157
00158
00159
00160 function loadGroupXMLChunk(newMediaGroup:XMLNode){
00161 var newMediaItems:Array = XPathAPI.selectNodeList(newMediaGroup, "/mediaGroup/media/item");
00162 for(var i:Number=0;i<newMediaItems.length;i++){
00163 var renditions:Array = XPathAPI.selectNodeList(newMediaItems[i], "/item/renditions/rendition");
00164 for(var j:Number=0;j<renditions.length;j++){
00165 if(renditions[j].attributes.size == "thumb"){
00166 _aThumbClips[_iXmlGroupChunkIndex+i]._strThumbUrl = renditions[j].attributes.src;
00167
00168 break;
00169 }
00170 }
00171 }
00172 _aThumbClips[_iXmlGroupChunkIndex].loadThumb(this);
00173 _iXmlGroupChunkIndex += i;
00174 }
00175
00176
00177
00178
00179
00180
00181
00182
00183 public function smartLoader():Void {
00184
00185
00186 if (_aThumbClips[_iSmartLoaderIndex].strLoaded == "false") {
00187
00188 _root.gallery.writeDebug("THUMB smartload" + _iSmartLoaderCount);
00189 this._aThumbClips[_iSmartLoaderIndex].loadThumb(this);
00190
00191 if (this._iSmartLoaderIndex == this._aThumbClips.length-1) {
00192 _iSmartLoaderIndex = 0;
00193 } else {
00194 this._iSmartLoaderIndex++;
00195 }
00196
00197 this._iSmartLoaderCount++;
00198 } else {
00199
00200 if (this._iSmartLoaderCount<_aThumbClips.length) {
00201
00202 if (this._iSmartLoaderIndex == this._aThumbClips.length-1) {
00203 _iSmartLoaderIndex = 0;
00204 } else {
00205 this._iSmartLoaderIndex++;
00206 }
00207 smartLoader();
00208 } else {
00209 this.bLoadingComplete = true;
00210 }
00211 }
00212
00213 }
00214
00215 private function checkScrollPos(){
00216 if(this._parent._strViewMode == "galleryScrollingLeft")
00217 var scrollPercentage:Number = (this._y - this._parent.ScrollLine._y)/this._parent._iScrollDistance;
00218 else
00219 var scrollPercentage:Number = (this._x - this._parent.ScrollLine._x)/this._parent._iScrollDistance;
00220
00221 var maxOffset:Number = this._parent._aThumbClips.length-this._parent._iThumbsPerPage;
00222 var scrollOffset:Number = Math.round(scrollPercentage*maxOffset);
00223 this._parent.scrollThumbsOffset(scrollOffset);
00224
00225 }
00226
00227 public function scrollThumbDrag(){
00228 this.onEnterFrame = this._parent.checkScrollPos;
00229 this._parent._bScrollUsed = true;
00230 if(this._parent._strViewMode == "galleryScrollingLeft"){
00231 startDrag(this,false,this._x,this._parent.ScrollLine._y,this._x,this._parent._iScrollDistance+this._parent.ScrollLine._y);
00232 }
00233 else
00234 startDrag(this,false,this._parent.ScrollLine._x,this._y,this._parent._iScrollDistance+this._parent.ScrollLine._x,this._y);
00235
00236 }
00237
00238 public function scrollThumbStopDrag(){
00239 this.onEnterFrame = null;
00240 stopDrag();
00241 }
00242
00243
00244 public function scrollThumbsRight(){
00245 if(this._iThumbsPerPage + this._thumbnailOffset <= this._aThumbClips.length-1){
00246 this._thumbnailOffset += 1;
00247 this.arrangeThumbs();
00248 var maxOffset:Number = this._aThumbClips.length-this._iThumbsPerPage;
00249 var displacement:Number = this._iScrollDistance/maxOffset;
00250 this.ScrollThumb._x = this.ScrollLine._x + (displacement*this._thumbnailOffset);
00251
00252
00253 }
00254
00255 }
00256 public function scrollThumbsLeft(){
00257 if(this._thumbnailOffset > 0){
00258 this._thumbnailOffset -= 1;
00259 this.arrangeThumbs();
00260 var maxOffset:Number = this._aThumbClips.length-this._iThumbsPerPage;
00261 var displacement:Number = this._iScrollDistance/maxOffset;
00262 this.ScrollThumb._x = this.ScrollLine._x + (displacement*this._thumbnailOffset);
00263
00264
00265 }
00266 }
00267
00268 public function scrollThumbsDown(){
00269 if(this._iThumbsPerPage + this._thumbnailOffset <= this._aThumbClips.length-1){
00270 this._thumbnailOffset += 1;
00271 this.arrangeThumbs();
00272 var maxOffset:Number = this._aThumbClips.length-this._iThumbsPerPage;
00273 var displacement:Number = this._iScrollDistance/maxOffset;
00274 this.ScrollThumb._y = this.ScrollLine._y + (displacement*this._thumbnailOffset);
00275
00276
00277 }
00278
00279 }
00280 public function scrollThumbsUp(){
00281 if(this._thumbnailOffset > 0){
00282 this._thumbnailOffset -= 1;
00283 this.arrangeThumbs();
00284 var maxOffset:Number = this._aThumbClips.length-this._iThumbsPerPage;
00285 var displacement:Number = this._iScrollDistance/maxOffset;
00286 this.ScrollThumb._y = this.ScrollLine._y + (displacement*this._thumbnailOffset);
00287
00288
00289 }
00290 }
00291
00292 public function scrollThumbsOffset(offset:Number){
00293 if((offset >= 0)&&(offset <= this._parent._aThumbClips.length-this._parent._iThumbsPerPage)){
00294 this._thumbnailOffset = offset;
00295 this.arrangeThumbs();
00296 }
00297 }
00298
00299
00300
00301
00302
00303
00304 public function dispatchEvent(eventName:String,eventValue:Object){
00305 if(eventName == "thumbClick"){
00306 this.setCurrentThumbNum(parseInt(eventValue.toString()));
00307 _parent.dispatchEvent("thumbClick",eventValue);
00308 }
00309 else if(eventName == "pageControl"){
00310 this.pageControl(eventValue);
00311 _parent.dispatchEvent("pageControl",eventValue);
00312 }
00313 }
00314
00315
00316
00317
00318
00319
00320 public function parseMediaGroup(xmlPhotoGroup:XMLNode) {
00321
00322 this._aThumbClips = new Array();
00323 var imageSizes:Array = XPathAPI.selectNodeList(xmlPhotoGroup,"/mediaGroup/sizes/imageSize");
00324
00325 for(var i:Number=0;i<imageSizes.length;i++) {
00326 if(imageSizes[i].attributes.size == "thumb"){
00327 setThumbMaxDim(parseFloat(imageSizes[i].attributes.maxwidth),parseFloat(imageSizes[i].attributes.maxheight));
00328 break;
00329 }
00330 }
00331
00332
00333 var mediaItems:Array = XPathAPI.selectNodeList(xmlPhotoGroup,"/mediaGroup/media/item");
00334 var strTotalGallerySize:String = XPathAPI.selectSingleNode(xmlPhotoGroup, "/mediaGroup/media").attributes.totalGallerySize;
00335 var strMediaUrl:String;
00336
00337
00338 for(var i:Number=0;i<mediaItems.length;i++) {
00339 var aRenditions:Array = XPathAPI.selectNodeList(mediaItems[i],"/item/renditions/rendition");
00340 for(var j:Number=0;j<aRenditions.length;j++){
00341 if(aRenditions[j].attributes.size == "thumb"){
00342 this.addThumbClip(aRenditions[j].attributes.src,(aRenditions[j].attributes.type == "blankObj"));
00343 break;
00344 }
00345 }
00346 }
00347
00348 if(strTotalGallerySize){
00349 var totalGallerySize:Number = parseInt(strTotalGallerySize);
00350
00351 if(totalGallerySize > mediaItems.length){
00352 var numBlanks:Number = totalGallerySize - mediaItems.length;
00353 for(var j:Number = 0;j<numBlanks;j++){
00354
00355 this.addThumbClip("",true);
00356
00357
00358 }
00359 }
00360 }
00361
00362 }
00363
00364 public function addThumbClip(thumbUrl:String,isBlank:Boolean):Void{
00365 var oThumbClip:MovieClip = this.ThumbnailCanvas.attachMovie("mcThumbClip", "thumbclip"+this._aThumbClips.length, 1000+this._aThumbClips.length);
00366 oThumbClip.tabIndex = this._iTabIndex + this._aThumbClips.length;
00367
00368
00369 if(isBlank && (this._aThumbClips.length < _iXmlGroupChunkIndex)){
00370 oThumbClip._bBlankObj = true;
00371 _iXmlGroupChunkIndex = this._aThumbClips.length;
00372 }
00373 var fullThumbUrl:String = this._strBaseRefUrl+thumbUrl;
00374 oThumbClip.initClip(this._aThumbClips.length,fullThumbUrl,this._iThumbClipMaxWidth,this._iThumbClipMaxHeight,_iThumbClipBorderColor,_iThumbClipBorderAlpha,_iThumbClipBorderWidth,_iThumbClipHover,_iThumbClipHoverAlpha,_iThumbClipSelected,_iThumbClipSelectedAlpha,_bDropShadows);
00375
00376 this._aThumbClips.push(oThumbClip);
00377 }
00378
00379 public function setThumbMaxDim(maxWidth:Number,maxHeight:Number){
00380 this._iThumbClipMaxWidth = maxWidth;
00381 this._iThumbClipMaxHeight = maxHeight;
00382 }
00383
00384 public function setInitThumb(initThumb:Number):Void {
00385 this._aThumbClips[initThumb].bActive = true;
00386 this._iCurrentThumb = initThumb;
00387
00388 }
00389
00390 public function setCurrentThumbStr(dir:String):Void {
00391
00392 if((dir == "forward") || (dir == "play")){
00393 var newCurr = this._iCurrentThumb + 1;
00394 if (newCurr > this._aThumbClips.length-1)
00395 newCurr = 0;
00396 }
00397 else if(dir == "back"){
00398 var newCurr = this._iCurrentThumb - 1;
00399 if (newCurr < 0)
00400 newCurr = this._aThumbClips.length-1;
00401 }
00402 var pageNum:Number = Math.floor(newCurr/this._iThumbsPerPage)+1;
00403 this.pageControl(pageNum);
00404 this._aThumbClips[this._iCurrentThumb].setCurrent(false);
00405 this._aThumbClips[newCurr].setCurrent(true);
00406 this._iCurrentThumb = newCurr;
00407
00408 }
00409
00410 public function setCurrentThumbNum(newCurr:Number):Void {
00411 this._aThumbClips[this._iCurrentThumb].setCurrent(false);
00412 this._aThumbClips[newCurr].setCurrent(true);
00413 this._iCurrentThumb = newCurr;
00414 if((_strViewMode == "galleryDefault")||(_strViewMode == "slideshowDefault")){
00415 var pageNum:Number = Math.floor(newCurr/this._iThumbsPerPage)+1;
00416 this.pageControl(pageNum);
00417 }
00418 else if (_strViewMode == "galleryScrollingBottom"){
00419
00420 if (newCurr == 0){
00421
00422 this._thumbnailOffset = 0;
00423 this.arrangeThumbs();
00424 this.ScrollThumb._x = this.ScrollLine._x;
00425 }
00426 else if(newCurr == this._aThumbClips.length-1){
00427
00428 this._thumbnailOffset = (this._aThumbClips.length) -this._iThumbsPerPage;
00429 this.arrangeThumbs();
00430 var distance:Number = this._iScrollDistance+ this.ScrollLine._x;
00431 var maxOffset:Number = this._aThumbClips.length-this._iThumbsPerPage;
00432 var displacement:Number = distance/maxOffset;
00433 this.ScrollThumb._x = this._thumbnailOffset*displacement;
00434 }
00435 else if(newCurr >= this._iThumbsPerPage + this._thumbnailOffset){
00436
00437 this._thumbnailOffset += 1;
00438 this.arrangeThumbs();
00439 var distance:Number = this._iScrollDistance+ this.ScrollLine._x;
00440 var maxOffset:Number = this._aThumbClips.length-this._iThumbsPerPage;
00441 var displacement:Number = distance/maxOffset;
00442 this.ScrollThumb._x = this._thumbnailOffset*displacement;
00443
00444 }
00445 else if(newCurr < this._thumbnailOffset){
00446 this._thumbnailOffset = newCurr;
00447 this.arrangeThumbs();
00448 var distance:Number = this._iScrollDistance+ this.ScrollLine._x;
00449 var maxOffset:Number = this._aThumbClips.length-this._iThumbsPerPage;
00450 var displacement:Number = distance/maxOffset;
00451 this.ScrollThumb._x = this._thumbnailOffset*displacement;
00452 }
00453
00454
00455
00456 }
00457 else if (_strViewMode == "galleryScrollingLeft"){
00458 if (newCurr == 0){
00459
00460 this._thumbnailOffset = 0;
00461 this.arrangeThumbs();
00462 this.ScrollThumb._y = this.ScrollLine._y;
00463 }
00464 else if(newCurr == this._aThumbClips.length-1){
00465
00466 this._thumbnailOffset = (this._aThumbClips.length) -this._iThumbsPerPage;
00467 this.arrangeThumbs();
00468 var distance:Number = this._iScrollDistance+ this.ScrollLine._y;
00469 var maxOffset:Number = this._aThumbClips.length-this._iThumbsPerPage;
00470 var displacement:Number = distance/maxOffset;
00471 this.ScrollThumb._y = this._thumbnailOffset*displacement;
00472 }
00473 else if(newCurr >= this._iThumbsPerPage + this._thumbnailOffset){
00474
00475 this._thumbnailOffset += 1;
00476 this.arrangeThumbs();
00477 var distance:Number = this._iScrollDistance+ this.ScrollLine._y;
00478 var maxOffset:Number = this._aThumbClips.length-this._iThumbsPerPage;
00479 var displacement:Number = distance/maxOffset;
00480 this.ScrollThumb._y = this._thumbnailOffset*displacement;
00481
00482 }
00483 else if(newCurr < this._thumbnailOffset){
00484 this._thumbnailOffset = newCurr;
00485 this.arrangeThumbs();
00486 var distance:Number = this._iScrollDistance+ this.ScrollLine._y;
00487 var maxOffset:Number = this._aThumbClips.length-this._iThumbsPerPage;
00488 var displacement:Number = distance/maxOffset;
00489 this.ScrollThumb._y = this._thumbnailOffset*displacement;
00490 }
00491
00492
00493
00494
00495
00496
00497
00498 }
00499 }
00500
00501
00502
00503 private function createMask(startX:Number,startY:Number,width:Number,height:Number,clip:MovieClip):Void{
00504 clip.setMask(null);
00505 this.ThumbnailCanvasMask.clear();
00506 this.ThumbnailCanvasMask.beginFill(0x000000);
00507 this.ThumbnailCanvasMask.moveTo(startX,startY);
00508 this.ThumbnailCanvasMask.lineTo(startX + width,startY);
00509 this.ThumbnailCanvasMask.lineTo(startX + width,startY + height);
00510 this.ThumbnailCanvasMask.lineTo(startX,startY + height);
00511 this.ThumbnailCanvasMask.moveTo(startX,startY);
00512 this.ThumbnailCanvasMask.endFill();
00513
00514 }
00515
00516 public function clearThumbs():Void{
00517 for (var i:Number = 0; i<this._aThumbClips.length; i++) {
00518 _aThumbClips[i].removeMovieClip();
00519 }
00520 }
00521
00522
00523
00524
00525
00526
00527
00528 private function arrangeThumbs():Void {
00529
00530 if((_strViewMode == "galleryScrollingBottom")||(_strViewMode == "gallerySideMetadata")){
00531
00532 for (var i:Number = 0; i<this._aThumbClips.length; i++) {
00533 _aThumbClips[i]._visible = false;
00534 }
00535
00536 var iAvailableWidth:Number = this._iControlWidth-(2*_iThumbClipRightMargin);
00537 var iTotalThumbWidth:Number = _iThumbClipMaxWidth+(2*_iThumbClipBorderWidth)+_iThumbClipRightMargin;
00538 _iThumbsPerPage = Math.floor((this._iControlWidth-(2*_iThumbClipRightMargin))/iTotalThumbWidth);
00539 if(_iThumbsPerPage >= _aThumbClips.length){
00540 _iThumbsPerPage = _aThumbClips.length;
00541 this.ScrollThumb._visible = false;
00542
00543 this.ScrollLine._visible = false;
00544 this.ScrollBtnUp._visible = false;
00545 this.ScrollBtnDown._visible = false;
00546 this.ScrollBarBg.clear();
00547 }
00548 else {
00549 this.ScrollThumb._visible = true;
00550
00551 this.ScrollLine._visible = true;
00552 this.ScrollBtnUp._visible = true;
00553 this.ScrollBtnDown._visible = true;
00554 var thumbWidthPercentage:Number = _iThumbsPerPage/this._aThumbClips.length;
00555 if(this.ScrollLine._width*thumbWidthPercentage > 20)
00556 this.ScrollThumb.setWidth(this.ScrollLine._width*thumbWidthPercentage);
00557 else
00558 this.ScrollThumb.setWidth(20);
00559 this._iScrollDistance = (this.ScrollLine._width - this.ScrollThumb._width);
00560 }
00561
00562 var iTotalExtraSpace:Number = iAvailableWidth-(_iThumbsPerPage*iTotalThumbWidth)+_iThumbClipRightMargin;
00563 var spacePadding:Number = _iThumbClipRightMargin + (iTotalExtraSpace/2);
00564
00565
00566 if((this._aThumbClips.length-this._thumbnailOffset) < this._iThumbsPerPage){
00567 this._thumbnailOffset=(this._aThumbClips.length - this._iThumbsPerPage);
00568
00569 }
00570
00571
00572
00573
00574
00575
00576
00577 for (var i:Number = 0; i<_iThumbsPerPage; i++) {
00578
00579 if (_aThumbClips[i+this._thumbnailOffset].strLoaded == "false") {
00580
00581 }
00582
00583 _aThumbClips[i+this._thumbnailOffset]._y = 11;
00584
00585 _aThumbClips[i+this._thumbnailOffset]._x = spacePadding+((iTotalThumbWidth)*i);
00586 _aThumbClips[i+this._thumbnailOffset]._visible = true;
00587
00588 }
00589
00590 }
00591 else if(_strViewMode == "galleryScrollingLeft"){
00592
00593 for (var i:Number = 0; i<this._aThumbClips.length; i++) {
00594 _aThumbClips[i]._visible = false;
00595 }
00596
00597 var iAvailableHeight:Number = this._iControlHeight-(2*_iThumbClipLeftMargin);
00598 var iTotalThumbHeight:Number = _iThumbClipMaxHeight+(2*_iThumbClipBorderWidth)+(_iThumbClipLeftMargin*2);
00599
00600 _iThumbsPerPage = Math.floor((this._iControlHeight-(2*_iThumbClipLeftMargin))/iTotalThumbHeight);
00601
00602 if(_iThumbsPerPage >= _aThumbClips.length){
00603 _iThumbsPerPage = _aThumbClips.length;
00604 this.ScrollThumb._visible = false;
00605
00606 this.ScrollLine._visible = false;
00607 this.ScrollBtnUp._visible = false;
00608 this.ScrollBtnDown._visible = false;
00609 this.ScrollBarBg.clear();
00610 }
00611 else {
00612 this.ScrollThumb._visible = true;
00613
00614 this.ScrollLine._visible = true;
00615 this.ScrollBtnUp._visible = true;
00616 this.ScrollBtnDown._visible = true;
00617 var thumbHeightPercentage:Number = _iThumbsPerPage/this._aThumbClips.length;
00618
00619 if(this.ScrollLine._height*thumbHeightPercentage > 20)
00620 this.ScrollThumb.setHeight(this.ScrollLine._height*thumbHeightPercentage);
00621 else
00622 this.ScrollThumb._setHeight(20);
00623 this._iScrollDistance = (this.ScrollLine._height - this.ScrollThumb._height);
00624 }
00625
00626 var iTotalExtraSpace:Number = iAvailableHeight-(_iThumbsPerPage*iTotalThumbHeight)+_iThumbClipLeftMargin;
00627 var spacePadding:Number = _iThumbClipLeftMargin + (iTotalExtraSpace/2);
00628
00629
00630 if((this._aThumbClips.length-this._thumbnailOffset) < this._iThumbsPerPage){
00631 this._thumbnailOffset=(this._aThumbClips.length - this._iThumbsPerPage);
00632
00633 }
00634
00635
00636
00637
00638
00639
00640
00641 for (var i:Number = 0; i<_iThumbsPerPage; i++) {
00642
00643 if (_aThumbClips[i+this._thumbnailOffset].strLoaded == "false") {
00644
00645 }
00646
00647 _aThumbClips[i+this._thumbnailOffset]._x = 11;
00648 _aThumbClips[i+this._thumbnailOffset]._y = spacePadding+((iTotalThumbHeight)*i);
00649
00650
00651 _aThumbClips[i+this._thumbnailOffset]._visible = true;
00652
00653 }
00654
00655 }
00656
00657 else if((_strViewMode == "galleryDefault")||(_strViewMode == "slideshowDefault")){
00658
00659 var iTotalThumbWidth:Number = _iThumbClipMaxWidth+(2*_iThumbClipBorderWidth)+_iThumbClipRightMargin;
00660 var iThumbRowHeight:Number = _iThumbClipMaxHeight+(2*_iThumbClipBorderWidth)+_iThumbClipBottomMargin;
00661
00662 var iThumbsPerRow:Number = Math.floor(this._iControlWidth/iTotalThumbWidth);
00663 var iTotalRows = Math.ceil(_aThumbClips.length/iThumbsPerRow);
00664
00665
00666
00667 var iRowsPerPage:Number = Math.floor((this._iControlHeight-_iThumbControlTopSpacer - _iPaginationButtonsBottomSpacer - 8)/iThumbRowHeight);
00668 _iThumbsPerPage = iRowsPerPage*iThumbsPerRow;
00669 _iTotalPages = Math.ceil(iTotalRows/iRowsPerPage);
00670
00671
00672 if (_iCurrentPage>_iTotalPages) {
00673 _iCurrentPage = _iTotalPages;
00674 }
00675
00676 var iThumbRowWidth = (iTotalThumbWidth*iThumbsPerRow)-_iThumbClipRightMargin;
00677 var iThumbLeftSpacer:Number = (this._iControlWidth/2)-(iThumbRowWidth/2);
00678 this._iStartThumb = (_iCurrentPage-1)*(iRowsPerPage*iThumbsPerRow);
00679 this._iEndThumb = (_iStartThumb+(_iThumbsPerPage))-1;
00680 if(this._iEndThumb > this._aThumbClips.length-1)
00681 this._iEndThumb = this._aThumbClips.length-1
00682
00683 var j, numLoading:Number = -1;
00684 for (var i:Number = 0; i<this._aThumbClips.length; i++) {
00685
00686 j = (_iCurrentPage-1)*(_iThumbsPerPage);
00687
00688 if ((i>=_iStartThumb) && (i<=_iEndThumb)) {
00689
00690 if (_aThumbClips[i].strLoaded == "false") {
00691
00692
00693
00694 numLoading = i;
00695 }
00696 _aThumbClips[i]._visible = true;
00697 _aThumbClips[i]._y = _iThumbControlTopSpacer+(iThumbRowHeight*(Math.ceil(((i-j)+1)/iThumbsPerRow)-1));
00698 _aThumbClips[i]._x = iThumbLeftSpacer+(iTotalThumbWidth)*((i)%iThumbsPerRow);
00699 } else {
00700 _aThumbClips[i]._visible = false;
00701 }
00702 }
00703 if (numLoading>-1) {
00704 _aThumbClips[numLoading].bLastToLoad = true;
00705 }
00706
00707 this.ThumbnailControls.updateDisplay(_iCurrentPage,_iTotalPages);
00708 }
00709
00710 }
00711
00712
00713
00714
00715
00716
00717 public function pageControl(whichPage:Object):Void{
00718 switch (whichPage) {
00719 case "nextPage":
00720 case "ThumbNextPage":
00721 if (_iCurrentPage<_iTotalPages)
00722 _iCurrentPage++;
00723 else
00724 _iCurrentPage = 1;
00725 arrangeThumbs();
00726 break;
00727 case "prevPage":
00728 case "ThumbPrevPage":
00729 if (_iCurrentPage>1)
00730 _iCurrentPage--;
00731 else
00732 _iCurrentPage = _iTotalPages;
00733 arrangeThumbs();
00734 break;
00735 case "ThumbFirstPage":
00736 if (_iCurrentPage != 1) {
00737 _iCurrentPage = 1;
00738 arrangeThumbs();
00739 }
00740 break;
00741 case "ThumbLastPage":
00742 if (_iCurrentPage != _iTotalPages) {
00743 _iCurrentPage = _iTotalPages;
00744 arrangeThumbs();
00745 }
00746 break;
00747 default:
00748
00749 _iCurrentPage = parseInt(whichPage.toString());
00750 arrangeThumbs();
00751 break;
00752 }
00753 }
00754
00755 public function setHeightWidth(h:Number,w:Number):Void {
00756
00757 this._iControlWidth = w;
00758 this._iControlHeight = h;
00759 this.ThumbnailViewBg.drawRectangle(w,h,7);
00760 if((_strViewMode == "galleryDefault")||(_strViewMode == "slideshowDefault")){
00761 this.ThumbnailControls._visible = true;
00762 this.ThumbnailControls._y = this._iControlHeight - this.ThumbnailControls._height - _iPaginationButtonsBottomSpacer;
00763 this.ThumbnailControls._x = (this._iControlWidth/2)-(this.ThumbnailControls._width/2);
00764 if(this._aThumbClips.length > 0)
00765 this.arrangeThumbs();
00766 this.ScrollBtnLeft._visible = false;
00767 this.ScrollBtnRight._visible = false;
00768 this.ScrollLine._visible = false;
00769 this.ScrollThumb._visible = false;
00770 this.ScrollBarBg.clear();
00771
00772
00773 }
00774 else if((_strViewMode == "galleryScrollingBottom")||(_strViewMode == "gallerySideMetadata")){
00775 this.ScrollBtnLeft._visible = true;
00776 this.ScrollBtnRight._visible = true;
00777 this.ScrollLine._visible = true;
00778
00779 this.ScrollBtnLeft._y = this.ScrollBtnRight._y = h - this._iScrollBarMargin - this.ScrollBtnLeft._height;
00780 this.ScrollBtnLeft._x = 12;
00781
00782 this.ScrollLine._y = this.ScrollBtnLeft._y + (this.ScrollBtnLeft._height/2) - 1;
00783 this.ScrollLine._x = this.ScrollBtnLeft._x + this.ScrollBtnLeft._width + 3;
00784 this.ScrollLine._width = this._iControlWidth - ((this.ScrollBtnLeft._x + this.ScrollBtnLeft._width + 3)*2);
00785
00786 this.ScrollBtnRight._x = this.ScrollLine._x + this.ScrollLine._width + 4;
00787
00788
00789 this.ScrollBarBg.clear();
00790
00791 this.ScrollBarBg.lineStyle(1, this._iScrollBarBorder, this._iScrollBarBorderAlpha, true, "none", "none", "miter", 1);
00792 this.ScrollBarBg.beginFill(this._iScrollBarFill, this._iScrollBarFillAlpha);
00793 this.ScrollBarBg.moveTo(this.ScrollLine._x - 2, this.ScrollLine._y - 6.5);
00794 this.ScrollBarBg.lineTo(this.ScrollLine._x + this.ScrollLine._width + 2, this.ScrollLine._y - 6.5);
00795 this.ScrollBarBg.lineTo(this.ScrollLine._x + this.ScrollLine._width + 2, this.ScrollLine._y + 6.5);
00796 this.ScrollBarBg.lineTo(this.ScrollLine._x - 2, this.ScrollLine._y + 6.5);
00797 this.ScrollBarBg.moveTo(this.ScrollLine._x - 2, this.ScrollLine._y - 6.5);
00798 this.ScrollBarBg.endFill();
00799
00800 if(this._aThumbClips.length > 0)
00801 this.arrangeThumbs();
00802 if(!_bScrollUsed)
00803 this.ScrollThumb._x = this.ScrollLine._x;
00804 else{
00805
00806 var thumbPos:Number = (this._thumbnailOffset/(this._aThumbClips.length-this._iThumbsPerPage))*this._iScrollDistance;
00807 this.ScrollThumb._x = thumbPos+this.ScrollLine._x;
00808
00809
00810 }
00811
00812 this.ScrollThumb._y = this.ScrollLine._y;
00813 this.ThumbnailControls._visible = false;
00814
00815 }
00816 else if(_strViewMode == "galleryScrollingLeft"){
00817 this.ScrollBtnUp._visible = true;
00818 this.ScrollBtnDown._visible = true;
00819 this.ScrollLine._visible = true;
00820
00821 this.ScrollBtnUp._x = this.ScrollBtnDown._x = w - this._iScrollBarMargin - this.ScrollBtnUp._width;
00822 this.ScrollBtnUp._y = this._iScrollBarMargin;
00823
00824 this.ScrollLine._y = this.ScrollBtnUp._y + this.ScrollBtnUp._height + 3;
00825 this.ScrollLine._x = this.ScrollBtnUp._x + (this.ScrollBtnUp._width/2);
00826
00827
00828
00829 this.ScrollLine._height = this._iControlHeight - ((this.ScrollBtnUp._y + this.ScrollBtnUp._height + 3)*2);
00830
00831 this.ScrollBtnDown._y = this.ScrollLine._y + this.ScrollLine._height + 4;
00832
00833
00834 this.ScrollBarBg.clear();
00835
00836 this.ScrollBarBg.lineStyle(1, this._iScrollBarBorder, this._iScrollBarBorderAlpha, true, "none", "none", "miter", 1);
00837 this.ScrollBarBg.beginFill(this._iScrollBarFill,this._iScrollBarFillAlpha);
00838 this.ScrollBarBg.moveTo(this.ScrollLine._x - 6.8, this.ScrollLine._y - 2);
00839 this.ScrollBarBg.lineTo(this.ScrollLine._x + 6.5, this.ScrollLine._y - 2);
00840 this.ScrollBarBg.lineTo(this.ScrollLine._x + 6.5, this.ScrollLine._y + this.ScrollLine._height + 2);
00841 this.ScrollBarBg.lineTo(this.ScrollLine._x - 6.8, this.ScrollLine._y + this.ScrollLine._height + 2);
00842 this.ScrollBarBg.moveTo(this.ScrollLine._x - 6.8, this.ScrollLine._y - 2);
00843 this.ScrollBarBg.endFill();
00844
00845
00846 if(this._aThumbClips.length > 0)
00847 this.arrangeThumbs();
00848
00849
00850 if(!_bScrollUsed){
00851 this.ScrollThumb._y = this.ScrollLine._y;
00852
00853 }
00854 else{
00855
00856 var thumbPos:Number = (this._thumbnailOffset/(this._aThumbClips.length-this._iThumbsPerPage))*this._iScrollDistance;
00857 this.ScrollThumb._y = thumbPos+this.ScrollLine._y;
00858
00859 }
00860
00861 this.ScrollThumb._x = this.ScrollLine._x;
00862 this.ThumbnailControls._visible = false;
00863
00864 }
00865
00866 }
00867
00868 public function parseStyleXML(styleNode:XMLNode):Void{
00869
00870
00871
00872 var xmlThumbnailViewBg:XMLNode = XPathAPI.selectSingleNode(styleNode,"/thumbnailView/thumbnailViewBgColor");
00873 var xmlThumbnailViewBorder:XMLNode = XPathAPI.selectSingleNode(styleNode,"/thumbnailView/thumbnailViewBorder");
00874
00875
00876 var xmlThumbBorder:XMLNode = XPathAPI.selectSingleNode(styleNode,"/thumbnailView/thumbnails/thumbBorder");
00877 var xmlThumbHover:XMLNode = XPathAPI.selectSingleNode(styleNode,"/thumbnailView/thumbnails/thumbHover");
00878 var xmlThumbSelected:XMLNode = XPathAPI.selectSingleNode(styleNode,"/thumbnailView/thumbnails/thumbSelected");
00879 var xmlThumbShadow:XMLNode = XPathAPI.selectSingleNode(styleNode,"/thumbnailView/thumbnails/thumbDropShadow");
00880
00881 var xmlThumbnailControlText:XMLNode = XPathAPI.selectSingleNode(styleNode,"/thumbnailView/thumbnailViewControls/thumbViewCtrlText");
00882 var xmlThumbnailControlBtnStroke:XMLNode = XPathAPI.selectSingleNode(styleNode,"/thumbnailView/thumbnailViewControls/thumbViewBtnBorder");
00883 var xmlThumbnailControlBtnFill:XMLNode = XPathAPI.selectSingleNode(styleNode,"/thumbnailView/thumbnailViewControls/thumbViewBtnBackground");
00884 var xmlThumbnailControlBtnFore:XMLNode = XPathAPI.selectSingleNode(styleNode,"/thumbnailView/thumbnailViewControls/thumbViewBtnFore");
00885
00886 var xmlThumbnailScrollBarFill:XMLNode = XPathAPI.selectSingleNode(styleNode,"/thumbnailView/thumbnailViewScrollBars/thumbnailViewScrollBarFill");
00887 var xmlThumbnailScrollBarFore:XMLNode = XPathAPI.selectSingleNode(styleNode,"/thumbnailView/thumbnailViewScrollBars/thumbnailViewScrollBarFore");
00888 var xmlThumbnailScrollBarBorder:XMLNode = XPathAPI.selectSingleNode(styleNode,"/thumbnailView/thumbnailViewScrollBars/thumbnailViewScrollBarBorder");
00889
00890
00891 if(xmlThumbShadow.attributes.enabled == "true")
00892 _bDropShadows = true;
00893 else
00894 _bDropShadows = false;
00895 _iThumbnailViewBg = parseInt("0x"+xmlThumbnailViewBg.attributes.color);
00896 _iThumbnailViewBgAlpha = parseInt(xmlThumbnailViewBg.attributes.alpha);
00897 _iThumbnailViewBorder = parseInt("0x"+xmlThumbnailViewBorder.attributes.color);
00898 _iThumbnailViewBorderAlpha = parseInt(xmlThumbnailViewBorder.attributes.alpha);
00899 _iThumbClipBorderColor = parseInt("0x"+xmlThumbBorder.attributes.color);
00900 _iThumbClipBorderAlpha = parseInt(xmlThumbBorder.attributes.alpha);
00901 _iThumbClipBorderWidth = parseFloat(xmlThumbBorder.attributes.width);
00902 _iThumbClipHover = parseInt("0x"+xmlThumbHover.attributes.color);
00903 _iThumbClipHoverAlpha = parseInt(xmlThumbHover.attributes.alpha);
00904 _iThumbClipSelected = parseInt("0x"+xmlThumbSelected.attributes.color);
00905 _iThumbClipSelectedAlpha = parseInt(xmlThumbSelected.attributes.alpha);
00906
00907 if(xmlThumbnailScrollBarFore){
00908 _iScrollBarBorder = parseInt("0x"+xmlThumbnailScrollBarBorder.attributes.color);
00909 _iScrollBarBorderAlpha = parseInt(xmlThumbnailScrollBarBorder.attributes.alpha);
00910 _iScrollBarFill = parseInt("0x"+xmlThumbnailScrollBarFill.attributes.color);
00911 _iScrollBarFillAlpha = parseInt(xmlThumbnailScrollBarFill.attributes.alpha);
00912 }
00913 else {
00914 _iScrollBarBorder = 0x1d1d1d;
00915 _iScrollBarBorderAlpha = 100;
00916 _iScrollBarFill = 0x1d1d1d;
00917 _iScrollBarFillAlpha = 100;
00918 }
00919
00920
00921
00922 this.ThumbnailViewBg.setColors(0,_iThumbnailViewBorder,_iThumbnailViewBorderAlpha,_iThumbnailViewBg,_iThumbnailViewBgAlpha);
00923
00924 if((_strViewMode == "galleryDefault")||(_strViewMode == "slideshowDefault")){
00925
00926 setTint(ThumbnailControls.ThumbControlText,xmlThumbnailControlText.attributes.color,xmlThumbnailControlText.attributes.alpha);
00927
00928 setTint(ThumbnailControls.ThumbLastPage.BtnFore,xmlThumbnailControlBtnFore.attributes.color,xmlThumbnailControlBtnFore.attributes.alpha);
00929 setTint(ThumbnailControls.ThumbLastPage.BtnBorder,xmlThumbnailControlBtnStroke.attributes.color,xmlThumbnailControlBtnStroke.attributes.alpha);
00930 setTint(ThumbnailControls.ThumbLastPage.BtnBg,xmlThumbnailControlBtnFill.attributes.color,xmlThumbnailControlBtnFill.attributes.alpha);
00931
00932 setTint(ThumbnailControls.ThumbNextPage.BtnFore,xmlThumbnailControlBtnFore.attributes.color,xmlThumbnailControlBtnFore.attributes.alpha);
00933 setTint(ThumbnailControls.ThumbNextPage.BtnBorder,xmlThumbnailControlBtnStroke.attributes.color,xmlThumbnailControlBtnStroke.attributes.alpha);
00934 setTint(ThumbnailControls.ThumbNextPage.BtnBg,xmlThumbnailControlBtnFill.attributes.color,xmlThumbnailControlBtnFill.attributes.alpha);
00935
00936 setTint(ThumbnailControls.ThumbPrevPage.BtnFore,xmlThumbnailControlBtnFore.attributes.color,xmlThumbnailControlBtnFore.attributes.alpha);
00937 setTint(ThumbnailControls.ThumbPrevPage.BtnBorder,xmlThumbnailControlBtnStroke.attributes.color,xmlThumbnailControlBtnStroke.attributes.alpha);
00938 setTint(ThumbnailControls.ThumbPrevPage.BtnBg,xmlThumbnailControlBtnFill.attributes.color,xmlThumbnailControlBtnFill.attributes.alpha);
00939
00940 setTint(ThumbnailControls.ThumbFirstPage.BtnFore,xmlThumbnailControlBtnFore.attributes.color,xmlThumbnailControlBtnFore.attributes.alpha);
00941 setTint(ThumbnailControls.ThumbFirstPage.BtnBorder,xmlThumbnailControlBtnStroke.attributes.color,xmlThumbnailControlBtnStroke.attributes.alpha);
00942 setTint(ThumbnailControls.ThumbFirstPage.BtnBg,xmlThumbnailControlBtnFill.attributes.color,xmlThumbnailControlBtnFill.attributes.alpha);
00943 }
00944 else if((_strViewMode == "galleryScrollingBottom")||(_strViewMode == "gallerySideMetadata")){
00945 if(xmlThumbnailScrollBarFore){
00946
00947 setTint(ScrollBtnRight.BtnFore,xmlThumbnailScrollBarFore.attributes.color,xmlThumbnailScrollBarFore.attributes.alpha);
00948 setTint(ScrollBtnRight.BtnBorder,xmlThumbnailScrollBarBorder.attributes.color,xmlThumbnailScrollBarBorder.attributes.alpha);
00949 setTint(ScrollBtnRight.BtnBg,xmlThumbnailScrollBarFill.attributes.color,xmlThumbnailScrollBarFill.attributes.alpha);
00950
00951 setTint(ScrollBtnLeft.BtnFore,xmlThumbnailScrollBarFore.attributes.color,xmlThumbnailScrollBarFore.attributes.alpha);
00952 setTint(ScrollBtnLeft.BtnBorder,xmlThumbnailScrollBarBorder.attributes.color,xmlThumbnailScrollBarBorder.attributes.alpha);
00953 setTint(ScrollBtnLeft.BtnBg,xmlThumbnailScrollBarFill.attributes.color,xmlThumbnailScrollBarFill.attributes.alpha);
00954
00955 setTint(ScrollThumb.middle.ScrollThumbBgFill,xmlThumbnailScrollBarFore.attributes.color,xmlThumbnailControlBtnFill.attributes.alpha);
00956 setTint(ScrollThumb.cap1.EndCapBg,xmlThumbnailScrollBarFore.attributes.color,xmlThumbnailControlBtnFill.attributes.alpha);
00957 setTint(ScrollThumb.cap2.EndCapBg,xmlThumbnailScrollBarFore.attributes.color,xmlThumbnailControlBtnFill.attributes.alpha);
00958 }
00959 }
00960 else if(_strViewMode == "galleryScrollingLeft"){
00961 if(xmlThumbnailScrollBarFore){
00962
00963 setTint(ScrollBtnUp.BtnFore,xmlThumbnailScrollBarFore.attributes.color,xmlThumbnailScrollBarFore.attributes.alpha);
00964 setTint(ScrollBtnUp.BtnBorder,xmlThumbnailScrollBarBorder.attributes.color,xmlThumbnailScrollBarBorder.attributes.alpha);
00965 setTint(ScrollBtnUp.BtnBg,xmlThumbnailScrollBarFill.attributes.color,xmlThumbnailScrollBarFill.attributes.alpha);
00966
00967 setTint(ScrollBtnDown.BtnFore,xmlThumbnailScrollBarFore.attributes.color,xmlThumbnailScrollBarFore.attributes.alpha);
00968 setTint(ScrollBtnDown.BtnBorder,xmlThumbnailScrollBarBorder.attributes.color,xmlThumbnailScrollBarBorder.attributes.alpha);
00969 setTint(ScrollBtnDown.BtnBg,xmlThumbnailScrollBarFill.attributes.color,xmlThumbnailScrollBarFill.attributes.alpha);
00970
00971 setTint(ScrollThumb.middle.ScrollThumbBgFill,xmlThumbnailScrollBarFore.attributes.color,xmlThumbnailControlBtnFill.attributes.alpha);
00972 setTint(ScrollThumb.cap1.EndCapBg,xmlThumbnailScrollBarFore.attributes.color,xmlThumbnailControlBtnFill.attributes.alpha);
00973 setTint(ScrollThumb.cap2.EndCapBg,xmlThumbnailScrollBarFore.attributes.color,xmlThumbnailControlBtnFill.attributes.alpha);
00974 }
00975
00976 }
00977 }
00978
00979 public function livePreview(whichPart:String,styleNode:XMLNode):Void{
00980 switch (whichPart) {
00981 case "thumbViewBgColor" :
00982 this._iThumbnailViewBg = parseInt("0x"+styleNode.attributes.color);
00983 this._iThumbnailViewBgAlpha = parseInt(styleNode.attributes.alpha);
00984 this.ThumbnailViewBg.setColors(0,_iThumbnailViewBorder,_iThumbnailViewBorderAlpha,_iThumbnailViewBg,_iThumbnailViewBgAlpha);
00985 break;
00986 case "thumbViewBorder" :
00987 this._iThumbnailViewBorder = parseInt("0x"+styleNode.attributes.color);
00988 this._iThumbnailViewBorderAlpha = parseInt(styleNode.attributes.alpha);
00989 this.ThumbnailViewBg.setColors(0,_iThumbnailViewBorder,_iThumbnailViewBorderAlpha,_iThumbnailViewBg,_iThumbnailViewBgAlpha);
00990 break;
00991 case "thumbBorder" :
00992 this._iThumbClipBorderWidth = parseFloat(styleNode.attributes.width);
00993 this._iThumbClipBorderColor = parseInt("0x"+styleNode.attributes.color);
00994 this._iThumbClipBorderAlpha = parseInt(styleNode.attributes.alpha);
00995
00996 for(var i=0;i<_aThumbClips.length;i++){
00997 _aThumbClips[i]._iBorderWidth = this._iThumbClipBorderWidth;
00998 _aThumbClips[i]._iBorderColor = this._iThumbClipBorderColor;
00999 _aThumbClips[i]._iBorderAlpha = this._iThumbClipBorderAlpha;
01000
01001 _aThumbClips[i]._iWidth = _iThumbClipMaxWidth + (2*this._iThumbClipBorderWidth);
01002 _aThumbClips[i]._iHeight = _iThumbClipMaxHeight + (2*this._iThumbClipBorderWidth);
01003 _aThumbClips[i].setBorder("plain");
01004 }
01005 this.setHeightWidth(this._iControlHeight,this._iControlWidth);
01006 break;
01007 case "thumbHover" :
01008 this._iThumbClipHover = parseInt("0x"+styleNode.attributes.color);
01009 this._iThumbClipHoverAlpha = parseInt(styleNode.attributes.alpha);
01010
01011 for(var i=0;i<_aThumbClips.length;i++){
01012 _aThumbClips[i]._iHoverColor = this._iThumbClipHover;
01013 _aThumbClips[i]._iHoverAlpha = this._iThumbClipHoverAlpha;
01014 }
01015
01016 break;
01017 case "thumbDropShadows" :
01018 if(styleNode.attributes.enabled == "true"){
01019 for(var i=0;i<_aThumbClips.length;i++){
01020 _aThumbClips[i].bDropShadows = true;
01021 _aThumbClips[i].setBorder("plain");
01022 }
01023 }
01024 else{
01025 for(var i=0;i<_aThumbClips.length;i++){
01026 _aThumbClips[i].bDropShadows = false;
01027 _aThumbClips[i].setBorder("plain");
01028 }
01029 }
01030 this.setHeightWidth(this._iControlHeight,this._iControlWidth);
01031 break;
01032 case "thumbSelected" :
01033 this._iThumbClipSelected = parseInt("0x"+styleNode.attributes.color);
01034 this._iThumbClipSelectedAlpha = parseInt(styleNode.attributes.alpha);
01035
01036 for(var i=0;i<_aThumbClips.length;i++){
01037 _aThumbClips[i]._iActiveColor = this._iThumbClipSelected;
01038 _aThumbClips[i]._iActiveAlpha = this._iThumbClipSelectedAlpha;
01039 }
01040 this._aThumbClips[this._iCurrentThumb].setBorder("active");
01041 break;
01042 case "thumbControlText" :
01043 setTint(ThumbnailControls.ThumbControlText,styleNode.attributes.color,styleNode.attributes.alpha);
01044 break;
01045 case "thumbCtrlBtnBorder" :
01046 if((_strViewMode == "galleryDefault")||(_strViewMode == "slideshowDefault")){
01047 setTint(ThumbnailControls.ThumbLastPage.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
01048 setTint(ThumbnailControls.ThumbNextPage.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
01049 setTint(ThumbnailControls.ThumbPrevPage.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
01050 setTint(ThumbnailControls.ThumbFirstPage.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
01051 }
01052 else if((_strViewMode == "galleryScrollingBottom")||(_strViewMode == "gallerySideMetadata")){
01053 setTint(ScrollBtnRight.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
01054 setTint(ScrollBtnLeft.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
01055 setTint(ScrollLine.ScrollLineBottom,styleNode.attributes.color,styleNode.attributes.alpha);
01056 setTint(ScrollThumb.ScrollThumbBorder,styleNode.attributes.color,styleNode.attributes.alpha);
01057 }
01058 else if(_strViewMode == "galleryScrollingLeft"){
01059 setTint(ScrollBtnRight.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
01060 setTint(ScrollBtnLeft.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
01061 setTint(ScrollLine.ScrollLineBottom,styleNode.attributes.color,styleNode.attributes.alpha);
01062 setTint(ScrollThumb.ScrollThumbBorder,styleNode.attributes.color,styleNode.attributes.alpha);
01063 }
01064 break;
01065 case "thumbCtrlBtnBg" :
01066 if((_strViewMode == "galleryDefault")||(_strViewMode == "slideshowDefault")){
01067 setTint(ThumbnailControls.ThumbLastPage.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
01068 setTint(ThumbnailControls.ThumbNextPage.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
01069 setTint(ThumbnailControls.ThumbPrevPage.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
01070 setTint(ThumbnailControls.ThumbFirstPage.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
01071 }
01072 else if((_strViewMode == "galleryScrollingBottom")||(_strViewMode == "gallerySideMetadata")){
01073 setTint(ScrollBtnRight.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
01074 setTint(ScrollBtnLeft.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
01075 setTint(ScrollLine.ScrollLineTop,styleNode.attributes.color,styleNode.attributes.alpha);
01076 setTint(ScrollThumb.ScrollThumbBg.ScrollThumbBgFill,styleNode.attributes.color,styleNode.attributes.alpha);
01077 }
01078 else if(_strViewMode == "galleryScrollingLeft"){
01079 setTint(ScrollBtnRight.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
01080 setTint(ScrollBtnLeft.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
01081 setTint(ScrollLine.ScrollLineTop,styleNode.attributes.color,styleNode.attributes.alpha);
01082 setTint(ScrollThumb.ScrollThumbBg.ScrollThumbBgFill,styleNode.attributes.color,styleNode.attributes.alpha);
01083 }
01084 break;
01085 case "thumbCtrlBtnFore" :
01086 if((_strViewMode == "galleryDefault")||(_strViewMode == "slideshowDefault")){
01087 setTint(ThumbnailControls.ThumbLastPage.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
01088 setTint(ThumbnailControls.ThumbNextPage.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
01089 setTint(ThumbnailControls.ThumbPrevPage.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
01090 setTint(ThumbnailControls.ThumbFirstPage.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
01091 }
01092 else if((_strViewMode == "galleryScrollingBottom")||(_strViewMode == "gallerySideMetadata")){
01093 setTint(ScrollBtnRight.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
01094 setTint(ScrollBtnLeft.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
01095 }
01096 else if(_strViewMode == "galleryScrollingLeft"){
01097 setTint(ScrollBtnUp.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
01098 setTint(ScrollBtnDown.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
01099 }
01100 break;
01101 case "thumbnailViewScrollBarFill" :
01102 if((_strViewMode == "galleryScrollingBottom")||(_strViewMode == "gallerySideMetadata")){
01103 setTint(ScrollBtnLeft.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
01104 setTint(ScrollBtnRight.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
01105
01106 }
01107 else if(_strViewMode == "galleryScrollingLeft"){
01108 setTint(ScrollBtnUp.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
01109 setTint(ScrollBtnDown.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
01110 }
01111
01112 this._iScrollBarFill = parseInt("0x"+styleNode.attributes.color);
01113 this._iScrollBarFillAlpha = parseInt(styleNode.attributes.alpha);
01114 this.setHeightWidth(this._iControlHeight,this._iControlWidth)
01115 break;
01116 case "thumbnailViewScrollBarFore" :
01117
01118 if((_strViewMode == "galleryScrollingBottom")||(_strViewMode == "gallerySideMetadata")){
01119 setTint(ScrollBtnLeft.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
01120 setTint(ScrollBtnRight.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
01121
01122 }
01123 else if(_strViewMode == "galleryScrollingLeft"){
01124 setTint(ScrollBtnUp.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
01125 setTint(ScrollBtnDown.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
01126 }
01127
01128 setTint(ScrollThumb.middle.ScrollThumbBgFill,styleNode.attributes.color,styleNode.attributes.alpha);
01129 setTint(ScrollThumb.cap1.EndCapBg,styleNode.attributes.color,styleNode.attributes.alpha);
01130 setTint(ScrollThumb.cap2.EndCapBg,styleNode.attributes.color,styleNode.attributes.alpha);
01131
01132 break;
01133 case "thumbnailViewScrollBarBorder" :
01134 if((_strViewMode == "galleryScrollingBottom")||(_strViewMode == "gallerySideMetadata")){
01135 setTint(ScrollBtnLeft.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
01136 setTint(ScrollBtnRight.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
01137
01138 }
01139 else if(_strViewMode == "galleryScrollingLeft"){
01140 setTint(ScrollBtnUp.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
01141 setTint(ScrollBtnDown.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
01142 }
01143
01144 this._iScrollBarBorder = parseInt("0x"+styleNode.attributes.color);
01145 this._iScrollBarBorderAlpha = parseInt(styleNode.attributes.alpha);
01146 this.setHeightWidth(this._iControlHeight,this._iControlWidth)
01147 break;
01148 }
01149
01150
01151 }
01152
01153
01154
01155
01156
01157
01158 function setTint(clip:MovieClip,hexval:String,alpha:String):Void {
01159 hexval = "0x" + hexval;
01160 var colorVal = parseInt(hexval);
01161 var alphaVal = parseInt(alpha);
01162 var color:Color = new Color(clip);
01163 var oColorTransform:Object = new Object();
01164 oColorTransform.ra = oColorTransform.ga = oColorTransform.ba = 0;
01165 oColorTransform.rb = (colorVal >> 16) & 0xFF;
01166 oColorTransform.gb = (colorVal >> 8) & 0xFF;
01167 oColorTransform.bb = colorVal & 0xFF;
01168 oColorTransform.ab = ((alphaVal/100)*255)-255;
01169 color.setTransform(oColorTransform);
01170 }
01171
01172
01173
01174 }