|
var myXML:XML = new XML(); //step 1st add new XML myXML.ignoreWhite = true; //step 2nd remove white space of xml in node myXML.load("Slider.xml");
//Load xml myXML.onLoad = function() { _root.SliderWidth = myXML.firstChild.attributes.width;//width of slider _root.SliderHeight = myXML.firstChild.attributes.height;//height of slider _root.Slider_Y = myXML.firstChild.attributes.y;//y position of slider _root.Image_width = myXML.firstChild.attributes.image_width;//width of images of slider _root.Vertical_spacing = myXML.firstChild.attributes.vertical_spacing;//vetical spacing of slider from top _root.bar_y = Number(_root.SliderHeight)+Number(_root.Vertical_spacing);//adjust bar of slider //flash takes as a number by apply "Number" _root.Bar_thickness = myXML.firstChild.attributes.bar_thickness;//adjust bar thickness of slider _root.scroll_width = _root.Bar_thickness*2;//width of scroll of slider _root.myImages = myXML.firstChild.childNodes;//loading of slider _root.myTotalImages = _root.myImages.length;//images are loading in myTotalImages variable //for big images _root.bigSlider_width = myXml.firstChild.attributes.gallery_width;//width for big gallery _root.bigSlider_height = myXml.firstChild.attributes.gallery_height;//height for big gallery _root.BigSlide_y = myXml.firstChild.attributes.slide_y;//y position for big gallery _root.bigImages_width = myXML.firstChild.attributes.bigImages_width;//width of images of Bigslider _root.vertical_Bigspacing = myXML.firstChild.attributes.vertical_Bigspacing;//vetical spacing of slider from top _root.BigImages = myXML.firstChild.childNodes;//loading of slider _root.TotalBigImages = _root.BigImages.length; //trace(myXML); myContainer(); BigContainer(); callImages(); masking(); scrollBar(); scroller(); _root.iCount=0; }; //small gallery function myContainer() { _root.myGallery = _root.createEmptyMovieClip("myGallery", _root.getNextHighestDepth()); _root.myGallery._y = _root.Slider_Y; _root.myGallery._x = _root.Image_width; trace("myContainer"); } //Big gallery function BigContainer() { var tm=new Date().getTime(); trace; _root.BigGallery = _root.createEmptyMovieClip("BigGallery"+tm, _root.getNextHighestDepth()); _root.BigGallery._y = _root.bigImages_width/2; _root.BigGallery._x = _root.bigImages_width; trace("BigGallery"); }
// call small Images function callImages() { _root.myImages_mc = _root.myGallery.createEmptyMovieClip("myImages_mc", _root.myGallery.getNextHighestDepth()); var myMCL:MovieClipLoader = new MovieClipLoader(); //var myMCL = new Object(); //myMCL.addListener(preloader); for (i=0; i<_root.myTotalImages; i++) { imageURL = _root.myImages[i].attributes.thumbs_url; image_mc = _root.myImages_mc.createEmptyMovieClip(i, myImages_mc.getNextHighestDepth()); image_mc._x = _root.Image_width*i; myMCL.loadClip("thumbs/" + imageURL,image_mc); _root.myImages_mc.onRelease = function() { CallMe(_root.myImages_mc); } } trace("LOAD"); }
CallMe =function(ctrl) { trace("Nits" + ctrl); //myImages_Big.loadMovie(this.image_B); //new code if(_root.iCount>_root.myTotalImages-1) { _root.iCount=0; } //callBigImages(_root.iCount);
showBigImg(iCount); _root.iCount+=1; }
function showBigImg(ichk) { trace("nish--" + ichk) _root.myBigImages =_root.BigGallery.createEmptyMovieClip("myBigImages", _root.BigGallery.getNextHighestDepth()); trace(_root.myBigImages + "ASDASDASd " + ichk); var myBMCL:MovieClipLoader = new MovieClipLoader(); for (var i=0; i<_root.myTotalImages; i++) { */ Date().getTime(); imageBURL =myXML.childNodes[0].childNodes[ichk].attributes.mainurl; image_Bmc._x = 0; trace(imageBURL); myBMCL.unloadClip(image_Bmc); image_Bmc = _root.myBigImages.createEmptyMovieClip(ichk, myBigImages.getNextHighestDepth()); myBMCL.loadClip("Images/" + imageBURL,image_Bmc); myBMCL=null; image_Bmc=null; BigContainer(); } / ******************************************************************************** *********************************/
// for small images function masking() { _root.Mask_mc = _root.myGallery.createEmptyMovieClip("Mask_mc", _root.myGallery.getNextHighestDepth()); _root.Mask_mc.beginFill(0x000000, 100); _root.Mask_mc.lineTo(_root.SliderWidth, 0); _root.Mask_mc.lineTo(_root.SliderWidth, _root.SliderHeight); _root.Mask_mc.lineTo(0, _root.SliderHeight); _root.Mask_mc.lineTo(0, 0); _root.Mask_mc.endFill(); _root.myImages_mc.setMask(_root.Mask_mc); trace("masking"); } // for big images function maskingBig() { _root.Mask_B = _root.BigGallery.createEmptyMovieClip("Mask_B", _root.BigGallery.getNextHighestDepth()); _root.Mask_B.beginFill(0x000000, 100); _root.Mask_B.lineTo(_root.bigSlider_width, 0); _root.Mask_B.lineTo(_root.bigSlider_width, _root.bigSlider_height); _root.Mask_B.lineTo(0, _root.bigSlider_height); _root.Mask_B.lineTo(0, 0); _root.Mask_B.endFill(); _root.myImages_Big.setMask(_root.Mask_B); trace("maskingB"); }
function scrollBar() { _root.scrollBar_mc = _root.myGallery.createEmptyMovieClip("scrollBar_mc", _root.myGallery.getNextHighestDepth()); _root.scrollBar_mc._y = _root.bar_y; _root.scrollBar_mc.beginFill(0x404040, 100); _root.scrollBar_mc.lineTo(_root.SliderWidth, 0); _root.scrollBar_mc.lineTo(_root.SliderWidth, _root.Bar_thickness); _root.scrollBar_mc.lineTo(0, _root.Bar_thickness); _root.scrollBar_mc.lineTo(0, 0); _root.scrollBar_mc.endFill(); _root.scrollBar_mc.onPress = function() { _root.scroller_mc._x=this._xmouse; if(_root.scroller_mc._x >(this._width-_root.scroller_mc._width)) { _root.scroller_mc._x = this._width-_root.scroller_mc._width; } mover(); } trace("scrollBar"); } function scroller () { _root.scroller_mc = _root.myGallery.createEmptyMovieClip("scroller_mc", _root.myGallery.getNextHighestDepth()); _root.scroller_mc._y = _root.bar_y;
_root.scroller_mc.beginFill(0xFF0000,100); _root.scroller_mc.lineTo(_root.scroll_width,0); _root.scroller_mc.lineTo(_root.scroll_width,_root.Bar_thickness); _root.scroller_mc.lineTo(0,_root.Bar_thickness); _root.scroller_mc.lineTo(0,0); _root.scroller_mc.endFill(); _root.scroller_mc.onPress = function() { startDrag(this,false,0,this._y,_root.scrollBar_mc._width-this._width,this._y); } _root.scroller_mc.onRelease = function() { stopDrag(); mover(); } trace("scroller"); } import mx.transitions.Tween; import mx.transitions.easing.*;
function mover(){ var scrollerLocation = _root.scroller_mc._x/(_root.scrollBar_mc._width-_root.scroller_mc._width); var galleryLocation = scrollerLocation*(_root.Mask_mc._width-_root.myImages_mc._width);
new Tween (_root.myImages_mc, "_x", Strong.easeOut, _root.myImages_mc._x, galleryLocation, 1.5, true); trace("MOVES"); }
|