mnb93
asked on
Effect to fade between images (Flash)
I am looking for a flash way to fade between images.
Something like:
http://slayeroffice.com/code/imageCrossFade/
Where I can add an array to the code and it displasys thoses images.
(Must be in flash, not javascript)
Steven
Something like:
http://slayeroffice.com/code/imageCrossFade/
Where I can add an array to the code and it displasys thoses images.
(Must be in flash, not javascript)
Steven
use motion tweening and change the alpha in the transition.. no need for any special code.. just put it into your timeline
ASKER
Yeah, but I want to be able to change the images without editing the flash.
then you need to incorporate Actionscript...thinking... .
You need use LoadVars() to load an array of urls into flash, using the urls, load non-progressive jpegs into instances of empty movie clip symbols.
Example of the array.txt file:
&img0=http://www.yoururlhere.com/img0.jpg
&img1=http://www.yoururlhere.com/img1.jpg
&img2=http://www.yoururlhere.com/img2.jpg
&img3=http://www.yoururlhere.com/img3.jpg
&img4=http://www.yoururlhere.com/img4.jpg
Example of the actionscript:
var reply_lv = new LoadVars();
reply_lv.load("array.txt")
reply_lv.onLoad = picArrayLoaded
function picArrayLoaded(success)
{
if(success)
{
loadMovie(reply_lv.img0, "mov_img0");
loadMovie(reply_lv.img1, "mov_img1");
loadMovie(reply_lv.img2, "mov_img2");
loadMovie(reply_lv.img3, "mov_img3");
loadMovie(reply_lv.img4, "mov_img4");
}
else
{
// Your error handling here
}
}
Create an empty movie clip symbol in the library, then drop 5 instances of it onto the stage, naming them mov_img0, mov_img1, ..
you can now do motion tweening and alpha changing on mov_img# and have the same effect appear on the images when they load.
A variation of that is to add a field in the text file to tell the flash how many urls there are, then loading them into different layers instead of movie clip instances, that way its possible to change the number of pics to load,you'll just have a tough time doing the fading effect.
if you need an example of that in source file, get in touch.
Cheers,
Ludovic
Example of the array.txt file:
&img0=http://www.yoururlhere.com/img0.jpg
&img1=http://www.yoururlhere.com/img1.jpg
&img2=http://www.yoururlhere.com/img2.jpg
&img3=http://www.yoururlhere.com/img3.jpg
&img4=http://www.yoururlhere.com/img4.jpg
Example of the actionscript:
var reply_lv = new LoadVars();
reply_lv.load("array.txt")
reply_lv.onLoad = picArrayLoaded
function picArrayLoaded(success)
{
if(success)
{
loadMovie(reply_lv.img0, "mov_img0");
loadMovie(reply_lv.img1, "mov_img1");
loadMovie(reply_lv.img2, "mov_img2");
loadMovie(reply_lv.img3, "mov_img3");
loadMovie(reply_lv.img4, "mov_img4");
}
else
{
// Your error handling here
}
}
Create an empty movie clip symbol in the library, then drop 5 instances of it onto the stage, naming them mov_img0, mov_img1, ..
you can now do motion tweening and alpha changing on mov_img# and have the same effect appear on the images when they load.
A variation of that is to add a field in the text file to tell the flash how many urls there are, then loading them into different layers instead of movie clip instances, that way its possible to change the number of pics to load,you'll just have a tough time doing the fading effect.
if you need an example of that in source file, get in touch.
Cheers,
Ludovic
ASKER
I want to have x amount of images. (And I do not have to change the x value)
Then just stick with the codes above, adding or removing to array.txt, loadmovie and number of mov_img#. If you dun wanna hard code the loadMovie, you can write a loop to do it (though personally I find that pointless as the loadmovie still needs time to load the jpegs anyways)
Uploaded an example here: www.geocities.com/wanderersong/groundZero/loadpic.zip
hope that helps
Cheers,
Ludovic
hope that helps
Cheers,
Ludovic
ASKER
&img0=test.jpg
&img1=3test.jpg
&img2=test.jpg
&img3=test.jpg
&img4=3test.jpg
I changed array.txt to the above but it still keeps repeating the first image.
&img1=3test.jpg
&img2=test.jpg
&img3=test.jpg
&img4=3test.jpg
I changed array.txt to the above but it still keeps repeating the first image.
the example was meant for a single jpg,
this is one for 3 images, you should be able to modify from there:
www.geocities.com/wanderersong/groundZero/loadpic2.zip
My apologizes for the confusion
Cheers,
Ludovic
this is one for 3 images, you should be able to modify from there:
www.geocities.com/wanderersong/groundZero/loadpic2.zip
My apologizes for the confusion
Cheers,
Ludovic
ASKER
Could you get it to loop? Please? (And a pause button)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.