Skip to main content
Participant
January 31, 2012
Question

Images load and shakes screen

  • January 31, 2012
  • 1 reply
  • 464 views

My SWF loads external images from an XML file.

The problem is the layout shakes up and down as each image is being loaded into the grid because the images are bigger in size than the thumbnail "holder" they are being placed in. They are bigger so when you click on a thumb and the layout zooms in, the images won't be pixelated.

I added all the images to the library of the fla file and exported in frame 1 but it didn't solve the shaking. Preloader worked, but images were still loaded in and then shrunk down to size.

How can I keep the SWF from loading the images then shrinking them. Any help or suggestions would be much appreciated.

www.mogulweb.com/dev

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
January 31, 2012

after loading is complete, smooth your thumb and then add to the stage at an integer x and integer y.

Participant
February 1, 2012

Thanks for your response... the images are loaded dynamically through XML.

Here is the code for loading the thumbs... what section would I apply visibility to? Also, the smoothing, not sure where to apply it. I will look up bitMap.draw(), thanks.

// loadThumbnails

function loadThumbs(list:Array):Void {

   

    // set stage size

    setStageSize();

    // create holder

    var holderMC:MovieClip = createEmptyMovieClip("holder_MC", 1);

   

    // populate images

    for (var i:Number = 0; i<list.length; i++) {

        //attach item to the holder

        itemMC = holderMC.attachMovie("item_MC", "item_MC_"+i, i);

        // size of the loader panel

        itemMC.loader_MC.panel_MC._width = thumbWidth;

        itemMC.loader_MC.panel_MC._height = thumbHeight;

        // put thumbnail

        thumbMCL.loadClip(list.attributes.thumb,itemMC.loader_MC);       

       

        //item name

        itemMC.name = list.attributes.name;

       

        //thumb links

        itemMC.thumbLink = list.attributes.thumbLink;

       

        //item number

        itemMC.n = i;

       

        // events

       

        // over

        itemMC.onRollOver = function(){

            // fade in

            ZigoEngine.doTween(this.loader_MC, "_brightness", 0,1 ,"easeOutExpo");

           

            // tooltip if set to true

            if(showTooltip){

                tooltip(this.name);

            }

        }

       

        // out

        itemMC.onRollOut = itemMC.onReleaseOutside = function(){

            //fade out

            ZigoEngine.doTween(this.loader_MC, "_brightness", -50,1 ,"easeOutExpo");

           

            // remove tooltip

            removeTooltip();

        }

       

        // press

        itemMC.onRelease = function(){

           

            // if theres thumbLink

            // open link without zooming

            if(this.thumbLink != undefined){

                getURL(this.thumbLink, "_blank");               

            }else{

                // stop movement

                movingNav = false;

               

                //record last Stage Width and Height

                lastStageW = stageW;

                lastStageH = stageH;

               

                //zoom

                zoomIn(this);

            }

        }

       

        //put number if enumerates is set to true

        if(enumerates){

            itemMC.numero_TXT.text = (i + 1);

        }

       

       

        // type of sorting

        if(sortType == "v"){

       

            // Sort Vertical//

           

            // pos

            xPos = xIni+(thumbWidth+thumbMargin)*count;

            itemMC._x = xPos;

            itemMC._y = yPos;

   

            //change row if stage is shorter than row length

            if ((xPos + thumbWidth)>stageW) {

   

                //reset count

                count = 0;

   

                // reset xPos

                xPos = xIni;

   

                // change row

                yPos = yPos+thumbHeight+thumbMargin;

            } else {

                // inc count

                count++;

            }// if

        }else{

       

            // Sort Horizontal//

           

            // pos

            yPos = yIni+(thumbHeight+thumbMargin)*count;

            itemMC._x = xPos;

            itemMC._y = yPos;

   

            //change column if stage is shorter than column length

            if ((yPos + thumbHeight)>stageH) {

   

                //reset count

                count = 0;

   

                // reset xPos

                yPos = yIni;

   

                // change column

                xPos = xPos+thumbWidth+thumbMargin;

            } else {

                // inc count

                count++;

            }// if

        }// tpye of sorting

       

    }// for

   

    // put holder for loaded big image

    imageMC = createEmptyMovieClip("loader_MC", 2);

    //start moving only the first time

    if(!init){

        movingNav = true;       

    }

   

    //enter event for moving

    holderMC.onEnterFrame = moveNav;

   

    //then center

    center();

   

    // put fixed mas for holder

    // if s not set to full screen

    if(!fullScreen){

        setFixedMask();

    }

}

kglad
Community Expert
Community Expert
February 1, 2012

the first problem i see is the is no panel_MC in your load target once loading starts.  so, setting that width/height does nothing useful.