Results 1 to 2 of 2

Thread: jpg's becoming distorted in swf file

  1. #1
    Join Date
    Jul 2008
    Location
    boston, ma
    Posts
    88
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default jpg's becoming distorted in swf file

    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();

  2. #2
    Join Date
    Jul 2008
    Location
    boston, ma
    Posts
    88
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    Update on code. here is where the large images are generated.
    Code:
    // ON IMAGE LOAD /////////////////////////////////////////////////////////////////////////////////
    alignPic = function () {
    	destWidth = holder._width;
    	destHeight = holder._height;
    	holder._x = (_global.stageW-holder._width)/2;
    	holder._y = (_global.stageH-holder._height)/2;
    	bg_mc.bg._width += (destWidth+border-bg_mc.bg._width)/5;
    	bg_mc.bg._height += (destHeight+border-bg_mc.bg._height)/5;
    	bg_mc.bg._x = holder._x;
    	bg_mc.bg._y = holder._y;
    	bg_mc._x = holder._width/2;
    	bg_mc._y = holder._height/2;
    	bttnNext._y = holder._y+(holder._height-bttnNext._height)/2;
    	bttnNext._x = bg_mc._width+(_global.stageW-bg_mc._width)/2-bttnNext._width-border/2;
    	bttnPrev._y = holder._y+(holder._height-bttnPrev._height)/2;
    	bttnPrev._x = (_global.stageW-bg_mc._width)/2+bttnPrev._width+border/2;
    	preloader._x = holder._x+holder._width/2;
    	preloader._y = holder._y+holder._height/2;
    	info_mc._x = holder._x;
    	info_mc._y = holder._y+holder._height-info_mc._height;
    	info_mc.bg._width = holder._width;
    	info_mc.txt.htmlText = _parent.Copy[ID];
    	info_mc.txt._width = info_mc.bg._width-20;
    	info_mc.txt._x = info_mc.bg._x+10;
    	info_mc.txt._height = info_mc.txt.textHeight+10;
    	info_mc.bg._height = info_mc.txt._height+20;
    	info_mc._x = holder._x;
    	info_mc._y = holder._y+holder._height-info_mc._height;
    	header_mc._x = holder._x;
    	header_mc._y = holder._y-50;
    	header_mc.pageName._x = holder._width-header_mc.pageName.textWidth;
    };
    alignPic();

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •