Sort of preloading won't work

[font=verdana, arial, helvetica][size=2]Hi,

I’m making a website with a portfolio in it. To show images, I made a transition effect (wipe effect).

Image 1 is displayed. Then you click a button, image 1 will get wiped out, new image is loaded, after the loading is complete, the wipe goes in the other direction and reveals the loaded image.

Take a look here:

http://users.pandora.be/stor1/flash/aversis/site_v3_02.html

click on 3d visualisations and then on the small spheres

you’ll notice my preloader doesn’t work. I made the jpg’s very big in filesize to see the fault on high speed connections.This is the code on frame 1:
Don’t mind the overdosis, I need to write it with arrays…
Basically it says that when a button is pressed, the wipe should go from left to right.


//loads image 1 automatically
_root.imageke = "images/3d/3d_01.jpg";
_root.container.loadMovie(_root.imageke);
 
subbolbutton3d_01._visible = false;
subbolbutton3d_02._visible = false;
 
button_3d.onRelease = function() {
subbol3d_01.gotoAndPlay("open");
subbolbutton3d_01._visible = true;
subbol3d_02.gotoAndPlay("open");
subbolbutton3d_02._visible = true;
};
 
subbolbutton3d_01.onRelease = function() {
if (subbol3d_01.color == "blauw") {
trace("blauw");
subbol3d_01.gotoAndPlay("springblauw");
_root.wiper._width = 5;
_root.wiper.endwidth = 709;
_root.imageke = "images/3d/3d_02.jpg";
} else {
trace("groen");
subbol3d_01.gotoAndPlay("springgroen");
_root.wiper._width = 5;
_root.wiper.endwidth = 709;
_root.imageke = "images/3d/3d_02.jpg";
}
};
subbolbutton3d_02.onRelease = function() {
if (subbol3d_02.color == "blauw") {
trace("blauw");
subbol3d_02.gotoAndPlay("springblauw");
_root.wiper._width = 5;
_root.wiper.endwidth = 709;
_root.imageke = "images/3d/3d_03.jpg";
} else {
trace("groen");
subbol3d_02.gotoAndPlay("springgroen");
_root.wiper._width = 5;
_root.wiper.endwidth = 709;
_root.imageke = "images/3d/3d_03.jpg";
}
};

This is the code on the wiper MC (the wiper is the red rectangle in the site, will be white when everything works)
This code makes the wiping effect happen. First to if’s check if the wipe goes to the left or to the right.


onClipEvent (load) {
speed = 4;
}
onClipEvent (enterFrame) {
if (_width<709 && endwidth>_width) {
_width += (Math.ceil((endwidth-_width)/speed));
}
if (_width<709 && endwidth<_width) {
_width += (Math.floor((endwidth-_width)/speed));
}
if (_width == 709) {
_root.container.loadMovie(_root.imageke);
filesize = container.getBytesTotal();
loaded = container.getBytesLoaded();
if (mybytesloaded == filesize) {
endwidth = 5;
_width = 708;
}
}
}

So when the wiper is at it’s maximum width (709px), the empty container MC should load an external jpg. But only after it is fully loaded the wiper should resize back to 5px width. This part doesn’t work. It seems that the

if (mybytesloaded == filesize)

is immediately true because it reads the getBytesTotal from the jpg currently loaded and not the getBytesTotal from the new jpg!

Why is this happening?

Imagine that code would work, a new problem is formed. Because while the image is loading, _width==709 all the time, so this piece of code will be executed over and over again for as long _width==709, so the new image will start loading over and over again very fast.

Can I tell flash to do something only once, even in an OnClipevent handler?

If you like, I can send you the source file by email, I don’t want to post it.

If there are Belgian people from around antwerp here with very good flash knowledge, please mail me, I’m looking for someone who can help me out with stuff like this on a regular basis! (payed of course!)

Kind regards,

wouter wynen[/size][/font]