Results 1 to 6 of 6

Thread: Slide question

  1. #1
    Join Date
    Apr 2007
    Posts
    149
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Slide question

    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....

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    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:

    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()
    	}
    }
    This will make your next/last buttons stop working. Why? Because they're not linked to anything. So we add the following:

    Code:
    next_btn.onPress = Next;
    last_btn.onPress = Last;
    Now for the automatic scrolling, use the setInterval function.

    Code:
    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:

    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 )

  3. #3
    Join Date
    Apr 2007
    Posts
    149
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks alot for your answer and time, im going to go ahead and try now it... thanks again.

  4. #4
    Join Date
    Apr 2007
    Posts
    149
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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.

  5. #5
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    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.

  6. #6
    Join Date
    Apr 2007
    Posts
    149
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •