Hello. Im new to flash and i found this tutorial, its great but i wanted to know if anybody can help me and tell me how to make it so that the images change automaticaly and still be able to change it with the arrows....
Hello. Im new to flash and i found this tutorial, its great but i wanted to know if anybody can help me and tell me how to make it so that the images change automaticaly and still be able to change it with the arrows....
Sure...
So right now you have something like this:
Code:// next button next_btn.onPress = fucntion() { if (mc_content._currentframe == mc_content.totalframes) { mc_content.gotoAndStop(1); } else { mc_content.nextFrame() } } //last button last_btn.onPress=function(){ if(mc_content._currentframe == 1){ mc_content.gotoAndStop(mc_content._totalframes) } else{ mc_content.prevFrame() } }
First thing to do is to turn these into independant functions. So, now you have this:
This will make your next/last buttons stop working. Why? Because they're not linked to anything. So we add the following:Code:// next button function Next() { if (mc_content._currentframe == mc_content.totalframes) { mc_content.gotoAndStop(1); } else { mc_content.nextFrame() } } //last button function Last() { if(mc_content._currentframe == 1){ mc_content.gotoAndStop(mc_content._totalframes) } else{ mc_content.prevFrame() } }
Now for the automatic scrolling, use the setInterval function.Code:next_btn.onPress = Next; last_btn.onPress = Last;
This piece of code is saying, run the Next(); function every 5000 miliseconds (5 seconds). Change the time to your preference.Code:setInterval( Next, 5000 )
So in the end your code looks like this:
Code:// next button next_btn.onPress = Next; function Next() { if (mc_content._currentframe == mc_content.totalframes) { mc_content.gotoAndStop(1); } else { mc_content.nextFrame() } } //last button last_btn.onPress = Last; function Last() { if(mc_content._currentframe == 1){ mc_content.gotoAndStop(mc_content._totalframes) } else{ mc_content.prevFrame() } } //setInterval setInterval( Next, 5000 )
Thanks alot for your answer and time, im going to go ahead and try now it... thanks again.
thanks again for your replay Medyman. i have a couple of questions more...
1. i put a link on every image just to try it first, then when i wanted to change it for the right link, it still sends me to the link i put first.... how can i change the link now? hope you get it...
2. i want the images to have a fade effect when they change...
if is not too much i ask you please to help me with this.... Thanks in advance.
Last edited by remp; 09-20-2007 at 09:08 PM.
How are you adding the links? Some code or better yet, your .fla would help diagnose the problem.
As far as the fading, you have three options;
1. Use timeline animation with alpha fades
2. Use a tweening engine like MCTween
3. Add a colored rectangle on top of everything and have it fade in and out between each image.
I think option three would be easiest to implement in this case, given how you have your file set up.
OK. thanks, but im really sorry to say that im starting with flash and im not quite sure how to do this... can you help me?
Last edited by remp; 09-24-2007 at 09:37 PM.
Bookmarks