Hi,
I have this xml driven image viewer. For some reason the jpgs when viewed are distorted. I didn't write the code, and can't figure out why the images are being distorted. Here is the link to the swf Click on the first thumbnail(reflective spiral) and you will see the large jpg distorted.
I pasted the code where I believe the sizing of the images happens. Any suggestions?
Thanks
Code:buildGallery = function () { galleryTotal = xmlNode.childNodes[galleryID].childNodes.length; totalThumbs = maxThumbs maxPage = Math.ceil(galleryTotal/maxThumbs); pageNum(); for (n=0; n<galleryTotal; n++) { Thumb[n] = xmlNode.childNodes[galleryID].childNodes[n].attributes.Thumb; Caption[n] = xmlNode.childNodes[galleryID].childNodes[n].attributes.Caption; Large[n] = xmlNode.childNodes[galleryID].childNodes[n].attributes.Large; Copy[n] = xmlNode.childNodes[galleryID].childNodes[n].childNodes[0].firstChild.nodeValue; } for (i=0; i<maxThumbs; i++) { num = i+(maxThumbs*page)-maxThumbs; if (num<galleryTotal) { item_mc.item.duplicateMovieClip("item"+i, i); ID = i+(maxThumbs*page)-maxThumbs; item_mc["item"+i].ID = ID; item_mc["item"+i]._x = (i%maxColumns)*(hSpace+thumbWidth); item_mc["item"+i]._y = Math.floor(i/maxColumns)*(vSpace+thumbHeight); item_mc["item"+i].num.text = ID; item_mc["item"+i].holder.loadMovie(Thumb[ID]); item_mc["item"+i].info_mc.txt_mc.txt.text = Caption[ID]; item_mc["item"+i].info_mc.txt_mc.txt._height = item_mc["item"+i].info_mc.txt_mc.txt.textHeight+5; item_mc["item"+i].info_mc.bg._height = item_mc["item"+i].info_mc.txt_mc.txt._height; item_mc["item"+i].info_mc._y = thumbHeight-item_mc["item"+i].info_mc.bg._height; } else { item_mc["item"+i].removeMovieClip(); } } item_mc.item._visible = false; item_mc._x = Math.round(_global.stageW/2-(((thumbWidth+hSpace)*maxColumns)-hSpace)/2); item_mc._y = Math.round(_global.stageH/2-(((thumbHeight+vSpace)*maxRows)-vSpace)/2); }; // LOAD XML ///////////////////////////////////////////////////////////////////////////////// loadXML = function (loaded) { if (loaded) { xmlNode = this.firstChild; total = xmlNode.childNodes.length; Thumb = []; Caption = []; Large = []; Copy = []; buildGallery(); for (n=0; n<total; n++) { menu_all.menu_mc.duplicateMovieClip("menu_mc"+n, n); menu_all["menu_mc"+n]._x = (menu_all.menu_mc._width+menuSpace)*n; menu_all["menu_mc"+n].categoryName.text = xmlNode.childNodes[n].attributes.Name; menu_all["menu_mc"+n].ID = n; menu_all["menu_mc"+n].num.text = subNum[n]; } alignObjects(); nav_mc._visible = true menu_all._visible = true } else { trace("Error loading XML"); } }; xmlData = new XML(); xmlData.ignoreWhite = true; xmlData.onLoad = loadXML; xmlData.load("content.xml"); stop();




Bookmarks