Hey everyone
Well, been getting everything figured out nicely. Mixing scripts from everywhere on this site haha but I can’t seem to figure one thing out. The images I will be using are larger than 300x200, and way larger than the thumbs. How do I have it so that flash will shrink the images down to the right size? I’m going to be busy IRL, and wont have time to make 2 sizes of all the images for my slideshows. So I need flash to do that for me. Can it do that? If so, how do I make the images apear 300x200 and 100x67? Here is my actionscript.
var total;
var p = 0;
var current;
var k = 0;
//variables for slideshow
var slide = 1;
var delay_slide;
//this is the interval between the pics: 6 seconds
var interS = 3000;
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
link = [];
total = xmlNode.childNodes.length;
for (var i = 0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
thumbnails* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
thumbnails_fn(i);
link* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
}
loadPic(p);
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("slide.xml");
/////////////////////////////////////
function loadPic(p) {
picture.loadMovie(image[p]);
picture._alpha = 0;
var temp = this.createEmptyMovieClip("tem", 9978);
temp.onEnterFrame = function() {
var filesize = picture.getBytesTotal();
var loaded = picture.getBytesLoaded();
preloader._visible = true;
preloader.preload_bar._xscale = Math.round((loaded/filesize)*100);
if (picture._width) {
preloader._visible = false;
picture.fadeTo(100, 1.1);
desc_txt.text = description[p];
slideshow();
picture_num();
picture._alpha += 7;
if (picture._alpha>100) {
picture._alpha = 100;
picture.onRelease = function() {
getURL(link[p], "_blank");
};
//if the slideshow is running
if (slide) {
delay_slide = setInterval(showSlide, interS, total);
}
delete this.onEnterFrame;
}
}
};
}
MovieClip.prototype.fadeIn = function() {
if (this._alpha<100) {
current._alpha -= 10;
this._alpha += 10;
} else {
current._visible = 0;
current = this;
delete this.onEnterFrame;
}
};
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
previous_btn.onRelease();
} else if (Key.getCode() == Key.RIGHT) {
next_btn.onRelease();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
p>0 ? (p--, loadPic(p), slide=0) : null;
};
next_btn.onRelease = function() {
p<total-1 ? (p++, loadPic(p), slide=0) : null;
slideshow();
};
//function for the slideshow
function showSlide(total) {
//clear the interval (if there's a slideshow)
clearInterval(delay_slide);
p<total-1 ? (p++, loadPic(p), setButtons(p)) : (p=0, loadPic(p), setButtons(p));
}
slide_btn._alpha = 50;
slide_btn.enabled = 0;
slide_btn.onRelease = function() {
this._alpha = 50;
this.enabled = 0;
stop_btn._alpha = 100;
stop_btn.enabled = 1;
slide = 1;
showSlide(total);
};
stop_btn.onRelease = function() {
clearInterval(delay_slide);
slide = 0;
this._alpha = 50;
this.enabled = 0;
slide_btn._alpha = 100;
slide_btn.enabled = 1;
};
function thumbNailScroller() {
// thumbnail code!
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 10;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._x -= scroll_speed;
} else if ((_root._xmouse<=(hit_left._x+40)) && (thumbnail_mc.hitTest(hit_left))) {
thumbnail_mc._x += scroll_speed;
}
} else {
delete tscroller.onEnterFrame;
}
};
}
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_left._x+(target_mc._width+5)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
I have tried doing a search, but can’t seem to find how to do it…maybe the code is in front of me and I don’t understand it.
And many thanks to the people here. I have learned much just looking threw the forums.
Thanks for any help:)