CODE
var myGalleryXML = new XML(); myGalleryXML.ignoreWhite = true; myGalleryXML.load("slideshow.xml"); myGalleryXML.onLoad = function() { _root.gallery_x = myGalleryXML.firstChild.attributes.gallery_x; _root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y; _root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width; _root.Image_width = myGalleryXML.firstChild.attributes.Image_width; _root.myImages = myGalleryXML.firstChild.childNodes; _root.myImagesTotal = myImages.length; _root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height; _root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width; _root.full_x = myGalleryXML.firstChild.attributes.full_x; _root.full_y = myGalleryXML.firstChild.attributes.full_y; createContainer(); createMask(); callThumbs(); scrolling(); callFullImage(0); var _CurrentNumber:Number; _CurrentNumber=1; var maxCount:Number; maxCount = 0; }; function callThumbs() { _root.createEmptyMovieClip("container_mc",_root.getNextHighestDepth()); container_mc._x = _root.gallery_x; container_mc._y = _root.gallery_y; var clipLoader = new MovieClipLoader(); var preloader = new Object(); clipLoader.addListener(preloader); maxCount = 0; for (i=0; i<myImagesTotal; i++) { thumbURL = myImages[i].attributes.thumb_url; maxCount = int(maxCount+1); myThumb_mc = container_mc.createEmptyMovieClip(i, container_mc.getNextHighestDepth() ); myThumb_mc._x = (_root.Image_width)*i; myThumb_mc._alpha = 70; myThumb_mc.swapDepths(100); clipLoader.loadClip("thumbs/"+thumbURL,myThumb_mc); preloader.onLoadStart = function(target) { target.createTextField("my_txt",target.getNextHighestDepth,0,0,100,20); target.my_txt.selectable = false; }; preloader.onLoadProgress = function(target, loadedBytes, totalBytes) { target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100); }; preloader.onLoadComplete=function(target){ new Tween(target, "_alpha", Regular.easeIn, 0, 100, .5, true); target.my_txt.removeTextField(); target.onRelease=function(){ callFullImage(this._name); _CurrentNumber=int(this._name); } target.onRollOver=function(){ this._alpha=100; }; target.onRollOut=function(){ this._alpha=80; }; } } } /***********************************thumbs end*****************/ function callFullImage(myNumber) { myURL = myImages[myNumber].attributes.full_url; //trace(myImages[myNumber].childNodes[0]); myTitle = myImages[myNumber].childNodes[0].firstChild.nodeValue; _root.createEmptyMovieClip("fullImage_mc",_root.getNextHighestDepth()); fullImage_mc._x = _root.full_x; fullImage_mc._y = _root.full_y; fullImage_mc.swapDepths(getNextHighestDepth); var fullClipLoader = new MovieClipLoader(); var fullPreloader = new Object(); fullClipLoader.addListener(fullPreloader); fullPreloader.onLoadStart = function(target) { target.createTextField("my_txt",fullImage_mc.getNextHighestDepth,0,0,600,500); target.my_txt.selectable = false; }; fullPreloader.onLoadProgress = function(target, loadedBytes, totalBytes) { target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100); }; fullPreloader.onLoadComplete = function(target) { new Tween(target, "_alpha", Regular.easeIn, 0, 40, 100, true); target.my_txt.text = myTitle; target.my_txt.textColor = 0xCFCFCF; target.my_txt.html = true; target.my_txt.label.condenseWhite= true; target.my_txt.wordWrap= true; target.my_txt._height = 50; target.my_txt.autoSize = true; target.my_txt.multiline = true; target.my_txt.background = true; target.my_txt.backgroundColor = 0x212121; }; fullClipLoader.loadClip("Images/"+myURL,fullImage_mc); } /***********************full Images end*******************************/ function createMask() { _root.createEmptyMovieClip("mask_mc",_root.getNextHighestDepth()); mask_mc._x = _root.gallery_x; mask_mc._y = _root.gallery_y; mask_mc.beginFill(0x000000,100); mask_mc.lineTo(_root.gallery_width,0); mask_mc.lineTo(_root.gallery_width,_root.gallery_height); mask_mc.lineTo(0,_root.gallery_height); mask_mc.lineTo(0,0); container_mc.setMask(_root.mask_mc); } /*******************************mask end*****************************************/ function scrolling() { _root.onEnterFrame = function() { if (mask_mc._xmouse<(mask_mc._width/2) || mask_mc._xmouse>(mask_mc._width)) { container_mc._x += Math.cos(((mask_mc._xmouse)/mask_mc._width)*Math.PI)*10; if (container_mc._x>mask_mc._x) { container_mc._x = mask_mc._x; } if (container_mc._x<(mask_mc._x-(container_mc._width-mask_mc._width))) { container_mc._x = mask_mc._x-(container_mc._width-mask_mc._width); } } }; } import mx.transitions.Tween; import mx.transitions.easing.*; btnNext.onRelease= function() { //trace(_CurrentNumber); _CurrentNumber=int(_CurrentNumber+1); if(int(_CurrentNumber+1)>int(maxCount)) { _CurrentNumber=0; //trace(maxCount); } callFullImage(_CurrentNumber); } btnPrev.onRelease= function() { //trace(_CurrentNumber); _CurrentNumber=int(_CurrentNumber-1); if(int(_CurrentNumber)<0) { _CurrentNumber=0; //trace(maxCount); } callFullImage(_CurrentNumber); }