Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

actionscript cross fade multiple pictures

Status
Not open for further replies.

wikfx

IS-IT--Management
Dec 16, 2001
196
MT
hi all well I am creating a movie and in the backround I want to have a series of 16 images crossfade between eachother showing one at a time for at least 2 to 3 seconds each I want to do this in actionscript though coz if I use a regular tween the rest of my movie slows down, I can put the pics directly into the library or load them dynamically it doesnt really matter for me can someone please help me??

WiKfx
 
with an empty clip (holder) and loading dynamically this should be ok but the code is off the top of my head and untested

pics = ["image1.jpg","pic2.jpg","image77.jpg"];
i = 0;
loadpic();
function loadpic(){
holder._alpha = 0;
holder.loadMovie(pics)
fadein = setInterval(fades,100)
}

function fades(){
holder._alpha +=5;
if(holder._alpha>=100){
clearInterval(fadein)
fadeout = setInterval(fade0,100)
}
}
function fade0(){
holder._alpha -=5;
if(holder._alpha<=0){
clearInterval(fadeout)
i++
if(i<=pics.length)loadpic()
}
}
 
forgot those annoying code tags
Code:
with an empty clip (holder) and loading dynamically this should be ok but the code is off the top of my head and untested

pics = &quot;image1.jpg&quot;,&quot;pic2.jpg&quot;,&quot;image77.jpg&quot;;
i = 0;
loadpic();
function loadpic(){
holder._alpha = 0;
holder.loadMovie(pics)
fadein = setInterval(fades,100)
}

function fades(){
holder._alpha +=5;
if(holder._alpha>=100){
clearInterval(fadein)
fadeout = setInterval(fade0,100)
}
}
function fade0(){
holder._alpha -=5;
if(holder._alpha<=0){
clearInterval(fadeout)
i++
if(i<=pics.length)loadpic()
}
}
 
forget it.....now it strips out the brackets....lousy piece of software....

when i get home i will stick up up an fla if you cant decifer the above
 
If you use the code tags, and just copy & paste the faulty script, of course they won't show.

If you can't manage that, you can allways disable the &quot;Process TGML&quot; box at the bottom of the reply window, on every one of your posts. Since you never use any TGML formating (nor punctation! - or rarely), it might be the your easiest way out.

As for using the &quot;preview&quot; feature before actually submiting your posts, guess that's not in your manners either! [bigcheeks]

Code:
pics = &quot;image1.jpg&quot;,&quot;pic2.jpg&quot;,&quot;image77.jpg&quot;;
i = 0;
loadpic();
function loadpic(){
holder._alpha = 0;
holder.loadMovie(pics[i])
fadein = setInterval(fades,100)
}

function fades(){
holder._alpha +=5;
if(holder._alpha>=100){
clearInterval(fadein)
fadeout = setInterval(fade0,100)
}
}
function fade0(){
holder._alpha -=5;
if(holder._alpha<=0){
clearInterval(fadeout);
i++;
if(i<=pics.length)loadpic()
}
}[code]


Regards,

[img]http://members.lamicro.com/~FGill/cubalibre2.gif[/img]
 
I cant reall get it it keeps cyclying just one pic it never changes the pic

WiKfx
 
thanks ever so much sorry I may be stupid sometimes :) my bad :)

WiKfx
 
something is wrong with me I still cant get it to work I am really dumb at actionscripting

WiKfx
 
Maybe if you posted a link to the .fla you have, I, others (or maybe even Billy!), could have a look at it for you.

Regards,

cubalibre2.gif
 
ok I got it now one last thing how do I make it loop I need it to have an infinate loop :) thank you guys sooo much for having patience with me :)

WiKfx
 
ok one last thing guys thanks so much for having patience with me all I need now is to loop it infinitly

WiKfx
 
just change this line

if(i<=pics.length)loadpic()

to

if(i==pics.length)i=0
loadpic()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top