Hi,
I am building a static photoviewer.
The point is that it will show 4 pictures in box placed boxes. Making it dynamic is to hard for me. :s
I load the picutres thru XML. All this works just fine… except for the following problems.
The boxes where the images should be shown in are 128*96, and the picutres are much bigger. I don’t know how to resize the JPG’s. I searched with google for a hint how to get the size of a JPG image loaded with loadMovie in flash, but didn’t got no good answer.
This is my actionscript:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("http://www.kazamwebdesign.com/new2/images/pics/img.xml");
p = 0;
this.onEnterFrame = function() {
picsize1 = picture1.getBytesTotal();
picsize2 = picture2.getBytesTotal();
picsize3 = picture3.getBytesTotal();
picsize4 = picture4.getBytesTotal();
picload1 = picture1.getBytesLoaded();
picload2 = picture2.getBytesLoaded();
picload3 = picture3.getBytesLoaded();
picload4 = picture4.getBytesLoaded();
var filesize = picsize1+picsize2+picsize3+picsize4;
var loaded = picload1+picload2+picload3+picload4;
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture1._alpha<100) {
picture1._alpha += 10;
}
if (picture2._alpha<100) {
picture2._alpha += 10;
}
if (picture3._alpha<100) {
picture3._alpha += 10;
}
if (picture4._alpha<100) {
picture4._alpha += 10;
}
}
};
function firstImage() {
if (loaded == filesize) {
picture1._alpha = 0;
picture2._alpha = 0;
picture3._alpha = 0;
picture4._alpha = 0;
picture1.loadMovie(image[0], 1);
picture2.loadMovie(image[1], 1);
picture3.loadMovie(image[2], 1);
picture4.loadMovie(image[3], 1);
}
}
The next problem I have is that I want to use a mouseover (rollover) on the images, se when I roll over image 1… the size of the image will be 256192 and will move the over 3 images to the side. On rollout it will go back to 12896. I can’t apply this either to my image… I don’t know how to resize the mask to.
I uploaded my script here:
- The images:
- The test script I made for testing how to resize movieclips:
Can somebody please help me with this, and explain to my how I should do this. Please remember that I am defenitly no flash expert.
Thanks a bunch!
Best regards,
Paul Peelen