View Full Version : Slide question
Hello. Im new to flash and i found this (http://www.layersmagazine.com/flash-slideshow-image-gallery.html) 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....
Medyman
09-18-2007, 01:28 PM
Sure...
So right now you have something like this:
// 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:
// 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()
}
}
This will make your next/last buttons stop working. Why? Because they're not linked to anything. So we add the following:
next_btn.onPress = Next;
last_btn.onPress = Last;
Now for the automatic scrolling, use the setInterval (http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary646.html) function.
setInterval( Next, 5000 )
This piece of code is saying, run the Next(); function every 5000 miliseconds (5 seconds). Change the time to your preference.
So in the end your code looks like this:
// 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.
Medyman
09-21-2007, 04:46 AM
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?
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.