PDA

View Full Version : morf from one pic to next?



oluc
December 19th, 2009, 10:50 PM
Hello. How would you morf from one picture to the next when loading it through xml and .load?

currently I have the pictures just fading, but before it fades to the next picture it fades from a blank screen and not from the previous picture that was displayed.

This is the code I have currently:



switch (buttonWanted) {
case "b1" :
imageLoader.load(new URLRequest (subImageArray [Number(e.currentTarget.name)-1]));
TweenLite.from(imageHolder, 1.5, {alpha:0});
break;

case "b2" :
imageLoader.load(new URLRequest (subImageArray [Number(e.currentTarget.name)-1]));
TweenLite.from(imageHolder, 1.5, {alpha:0});
break;
//etc for a total of 4 btns

thanks for any help!

excogitator
December 20th, 2009, 03:45 AM
I believe what you require is the transition from one image to another where the new image appears from transparent to opaque over the old image.
This is very simple to implement if you have two movieclips and best if the images are of the same dimensions.

1. Have two movieclips placed one over the other of same size.
2. Once the image is loaded in the front movieclip and its alpha has reached 100. You can now display this image in the second movieclip behind it as well. (So we now have two movieclips having the same image)
3. Load the next image in the front movieclip and set its transition from 0-100. Because the earlier picture was displayed in the movieclip behind it. It will seem as if the new image once loaded is appearing over the old one.

Hope that helps :)

oluc
December 20th, 2009, 07:00 PM
Thanks! that does help!

I created a movieclip below my main movieclip. Then I added and eventListener to the load command and that leads to public function loadCompleteHandler. This then removes the listener and is supposed to add the image to the back mc. But the adding the mc to the back mc is the part I am having a little dificulty with.

As you can see in the above code that I wrote, I am loading the image through e.currentTarget.name. But I won't be able to use e.currentTarget.name under the loadCompleteHandler constructor because what it refers to is not what it needs in order to load the image, (hopefully that makes sense). Would you be able to point out what tool I should be using?

Thanks in advance!