2 Replies Latest reply on Nov 8, 2011 7:07 AM by kglad

    How can I restart or load function

    jurzyna

      I am creting an application that containts 3 seperate slideshows inside movie clips, when one slideshow finishes the other starts. I do this by triggering the function inside the other movieclip slideshow ( _root.slideshow2.startSlideshow(); ) and stopping the currently running function startSlideshow = null; inside existing slide. It works until it gets to the 3rd slideshow and than everything freezes because all the functions where deleted. My question is how can I restart or reload the sam function again?

        • 1. Re: How can I restart or load function
          relaxatraja Level 5

          can you show the code?

          • 2. Re: How can I restart or load function
            kglad Adobe Community Professional & MVP

            use another variable to reference startSlideshow so you can alternately null and then re-define that variable.  for example, define startSlideshow:

             

            function startSlideshow(){

            //whatever

            }

             

            and don't ever directly call it.  use another variable to reference startSlideshow:

             

            var startSS:Function = startSlideshow;

             

            when you want that code to executed, null startSS when you want that code to stop

             

            startSS = null

             

            and then when you want it to restart,

             

            startSS = startSlideshow

             

            make sure none of your nested code calls startSlideshow directly.  all those old references to startSlideshow need to be changed to startSS.

            1 person found this helpful