Load jpg + preloader and fade in/out

Hey, I would like an combobox to load jpg’s into a container when a value is selected, and with fade out and in when a photo is change, and if possible a percent preloader.

I have this as to make the combobox load swf’s, but could anyone please be so kind to make it so it loads jpg’s with fade in and out and percent loader? :


// ComboBox
function handler() {
 chosen = _root.combobox.getSelectedItem().label;
 if (chosen == "Lagbilde") {
  _root.container.loadMovie("sound.swf");
 } else if (chosen == "Celluoid Dream") {
  _root.container.loadMovie("sound2.swf");
 } else if (chosen == "God Called In Sick Today") {
  _root.container.loadMovie("sound3.swf");
 } else if (chosen == "Fun, Fun, Fun") {
  _root.container.loadMovie("sound4.swf");
 }
}

Thanks in advance,
fatnslow

hey , there was an excellent discussion about a resizing gallery that faded jpgs in. do a search in the forums for it. if you cant figure it out let me know and ill send you my code that i ended up using on www.creativejuggernauts.com/daniel

Nice, but I have allready made something that fits my site, but it doesn’t work. See, I have 2 comboboxes that when you select one of the value’s it loads a jpg into a container, but it doesn’t work when I have the whole photo.swf loaded into main.swf, and the comboboxes get all white and looks weird, heres the as im using:


this.pathToPics = "bilder/";
this.pArray = ["image0.jpg", "image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", "image5.jpg"];
this.fadeSpeed = 20;
MovieClip.prototype.changePhoto = function(d) {
 this.pIndex = d;
 this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
 if (this.photo._alpha>this.fadeSpeed) {
  this.photo._alpha -= this.fadeSpeed;
 } else {
  this.loadPhoto();
 }
};
MovieClip.prototype.loadPhoto = function() {
 var p = this.photo;
 p._alpha = 0;
 p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
 this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
 var i, l, t;
 l = this.photo.getBytesLoaded();
 t = this.photo.getBytesTotal();
 if (t>0 && t == l) {
  this.onEnterFrame = fadeIn;
 } else {
  // trace(l/t);
 }
};
MovieClip.prototype.fadeIn = function() {
 if (this.photo._alpha<100-this.fadeSpeed) {
  this.photo._alpha += this.fadeSpeed;
 } else {
  this.photo._alpha = 100;
  this.onEnterFrame = null;
 }
};
// LOAD
_root.changePhoto(0);
// ***CB 1
formStyleFormat = new FStyleFormat();
formStyleFormat.textFont = "FFF Harmony";
formStyleFormat.textSize = "9";
formStyleFormat.addListener(comboBox);
//***CB 2
formStyleFormat = new FStyleFormat();
formStyleFormat.textFont = "FFF Harmony";
formStyleFormat.textSize = "9";
formStyleFormat.addListener(comboBox2);
// ComboBox
function handler() {
 chosen = _root.combobox.getSelectedItem().label;
 if (chosen == "Lagbilde") {
  _root.changePhoto(0);
 }
}
// ComboBox 2
function handler2() {
 chosen = _root.combobox2.getSelectedItem().label;
 if (chosen == "Axel") {
  _root.changePhoto(1);
 } else if (chosen == "Idol Arne") {
  _root.changePhoto(2);
 } else if (chosen == "Vaske Stian") {
  _root.changePhoto(3);
 }
}

and if anyone could insert a percent preloader fior each image I would super happy.

Thanks in advance,
fatnslow

Anyone able to help me here?

Thanks,
fatnslow

The preloader is allready there…look for the loadMeter proto.
It’s not working cause you’re using _root;)

scotty(-:

What should I use instead of _root? And how do I get the loader to show? put in a textfield with some var?

Thanks,
fatnslow

With a little search;)
The _root issue has been answered a zillion times eg
http://www.kirupaforum.com/forums/showthread.php?t=66037
or do a search on “standalone”, “_root” etc…
for the preloader:
http://www.kirupaforum.com/forums/showthread.php?t=66179 [size=1]post#5[/size]

scotty(-:

Hey thanks, got it fixed now, just had overlooked 2 _root.'s somewhere in there. But when I view my .swf online, the combobox get all weird, it has white instead of text, and the select highlight is all white, so you cant see the text you select. Anyone know how to fix that?

http://www.vsf-fc.tk , then go to “bilder”. The enter button doesnt work for someone, no idea why, but if so, just click the link under.

Thanks,
fatnslow

Th

Anyone ble to help please?

Thanks,
fatnslow

i’m trying to do the same sort of thing.
shouldn’t this code work to wait until something is loaded before continuing?

if (clippy.getBytesTotal() > 0 && getBytesLoaded() == getBytesTotal()){
	trace("* * * LOADED * * *");
	this.gotoAndPlay(39);
} else {
	this.gotoAndPlay("loadaniloop");
	}

well it seems to work fine when testing locally, but when it is published to the web, it hits the “* * * LOADED * * *” instructions before the clip is actually loaded.

i’m loading in a jpeg, BTW.

any suggestions?
thanks,
david

Sry, cant help. But still need some help on my combobox…

thanks in advance