PDA

View Full Version : XML loading thumbnails and main image



4gotten
December 17th, 2007, 10:01 PM
hi guys! i just wanna ask, if it is possible to load a thumbnail image that you can set the dimension of each thumbs. what i mean is, i have an image 400x600. when it loads to thumbnails i want the size to be 80x100.-- and another image is 400x500 and when it loads to thumbs i want the size to be 80x80... Actually this is flash gallery with thumbnails, that looks like this. Four Seasons Hotel Los Angeles at Beverly Hills - Photo gallery (http://www.fourseasons.com/losangeles/photo_gallery/).

thegrrraue
December 17th, 2007, 10:47 PM
Yeah, here's a thought:

Put the load image code inside of a movieclip. Tell that movieclip what its dimensions are using the x and y on the properties tab. That should tell the full size image to load in to a smaller movieclip, which should in turn cause the image to shrink to those dimensions.

4gotten
December 18th, 2007, 01:29 AM
hmm, this is interesting! could you explain a bit clear. i really wanted to know that.
do you have an example of that thing. im a little bit confused


anyways, do you have yahoomessenger or gmail.. thnks in advance.

thegrrraue
December 18th, 2007, 02:24 PM
Ok, so there are basically two ways to go about getting an image in your flash movie. The first is to simply embed it in the flash, the second is to have it loaded externally. I assume you're loading it externally as if you weren't, you'd simply put the image on your stage and change the size, so let's continue.

I'm also assuming that you already have a flash gallery of some sort built, so what you need to do now is look at your code. Copy the code that is loading an image that you want to make a thumbnail of. Now go to wherever it is in your movie that you want to place this thumbnail. Create a new movieclip, place it on the stage. Before you do anything to the movieclip, look at the properties tab. It has width and height specifications. Set those to be the size you want the picture to be.

In that movie clip, paste the code that loads the image. Make sure to reroute the code if you need to so that the image is being told to load here and not where it was before. This should create a smaller version of the same picture.

thegrrraue
December 18th, 2007, 02:33 PM
If that doesn't make sense, just resize the images and embed them.

4gotten
December 18th, 2007, 10:24 PM
im using xml.. I have two movieclip for the load image, the one is for the main image, and the other is for thumbnails. my problem is i cant able to change the size of the thumbnails. because it is fixed to 80x80. so, there's only one dimension i used.

here's the code i've been using.


function loadThumbs() {
var but:MovieClip = infoBox.scroller.container["thumb"+p];
but.thumbClip.loadMovie("images/"+pictures[p]);
var temp:MovieClip = _root.createEmptyMovieClip("temp"+p, p);
counterText_mc.loadingText.text = (p+1)+" / "+pictures.length;
temp.onEnterFrame = function() {
BL = but.thumbClip.getBytesLoaded();
BT = but.thumbClip.getBytesTotal();
percent = Math.round(BL/BT*100);
but.bar.gotoAndStop(percent);
if (BL == BT && but.thumbClip._width>1 && but.thumbClip._height>1) {
but.bar.gotoAndStop(1);
but.thumbClip._width = 80;
but.thumbClip._height = 80;
if (firstLoad == 1) {
but.onRelease();
but.fadeIn = true;
but.thumbClip._alpha = 100;
firstLoad = false;
} else {
but.fadeIn = false;
but.thumbClip.fade();
}
nextPic();
delete temp.onEnterFrame;
}
};
}