A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Slideshow buttons

  1. #1
    Junior Member
    Join Date
    Jul 2012
    Posts
    22

    Slideshow buttons

    Okay,so..
    I made this slideshow that plays 5 pics with one mc that loads count+".jpg" picture and i have this code in frames:
    Frame1:
    var count = "1";

    Frame3:
    Code:
    	stop();
    	onEnterFrame = function() {
    	_root.mc._alpha += 10 ;
    	if(this.mc._alpha > 100){
    		gotoAndStop(4);
    	
    	}
    	}
    Frame4:
    Code:
    stop();
    setTimeout(myFunction, 500);
    function myFunction()
    {
    	onEnterFrame = function() {
    	_root.mc._alpha -= 10 ;
    	if(this.mc._alpha < 0){
    		count++;
    		if(count > 5) {
    			count = 1;
    		}
    		gotoAndPlay(3);
    	
    	}
    	}
    }
    It works perfectly but when i try to add a button or mc that will change the var count (load a pic of my choice) it gets all buggy...

    SWF
    FLA
    Can anyone help me add the 5 buttons witch will change the pic?
    Thanks

  2. #2
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Working on it. I just can't stop/delete the onEnterFrame of the alpha animation. But i know if i keep working on it i will make it.
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

  3. #3
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,785
    Hi,

    Saw your thread thought i'd help out.

    Attachment 73919 : swf and fla(CS 6)

    No onEnterFrames, when a button is clicked it will fade out the exisiting image and load the new one, has image loader built in.
    Buttons are created based on the image amount.

    You will obviously need to have your images in the same directory.

    Fruity

  4. #4
    Junior Member
    Join Date
    Jul 2012
    Posts
    22
    The thing is that i'm using flash 8 :S

  5. #5
    Junior Member
    Join Date
    Jul 2012
    Posts
    22
    Okay installed flash cs6,yeah it does what it should do just can i change the speed of fading and time of switching pictures?
    AngelHDZ did you manage to do something?
    Thanks for helping

  6. #6
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,785
    Hi,

    you can control the speeds from the first frame, changing the time the image is shown for is as easy as adding frames between the gap, if you are capable you could add a setInterval instead.

  7. #7
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Morsus, i tried it but i didn't get it to work. What fruitbeard made is even better, but it still have a bug, and it is when you click the buttons not always the corresponding image is shown, sometimes it shows the first image. I think that is surely due to the function timeout. We need to manage to stop or delete it on buttons press. I tried clearTimeout , delete myFunction;, delete _root.onEnterFrame;, but nothing.
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

  8. #8
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,785
    Hi,

    You were right Angel, it was a tad buggy, so yet again, here it is fixed.

    my hobby

  9. #9
    Junior Member
    Join Date
    Jul 2012
    Posts
    22
    Works like a charm. Even if i do not really understand the code...but nvm xD
    Thanks a bunch guys

  10. #10
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Good job fruitbeard, he will love it. And very well played hehe, no need for use setTimeout function, using frames instead. It's a pain trying to stop or delete the the setTimeout function or the onEnterFrame within it.
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center