4 Replies Latest reply on Jul 5, 2006 9:01 AM by Newsgroup_User

    calling onPres from as

    Level 7
      O.K. I'm pretty rusty, and I often get things cross linked between
      different scripting and programming languages, but here goes.
      I am making a slide show with the standard forward and back buttons, but
      want to have an auto-play option that allows the viewer to stop, go
      back, or go forward without interrupting the auto-play functioning. How
      I planned to do this is by having the button_mc�s with standard onPress
      event handlers, and an interval timer that calls the onPress() methods
      directly. There�s nothing special that makes an event handler different
      from other methods that would prevent me from doing this is there?

      Bill
        • 1. calling onPres from as
          crockettroth Level 1
          Hello Bill,

          Are you checking to see if you can invoke the onPress method for the "button_mc" instance within your timer? (Sort of like, button_mc.onPress();)
          • 2. Re: calling onPres from as
            Level 7
            crockettroth wrote:
            > Hello Bill,
            >
            > Are you checking to see if you can invoke the onPress method for the "button_mc" instance wihtin your timer? (Sort of like, button_mc.onPress();)
            Yes. That way either the timer will advance to the next slide, or the
            user will by actually clicking button_mc.

            • 3. Re: calling onPres from as
              crockettroth Level 1
              Hello Bill,

              I tried it and had no success. What I normally do is encapsulate everything that needs to be done into a function then simple invoke that function from both locations.

              For example:

              myButton_mc.onPress = function(){
              advanceToNextScreen();
              };

              function advanceToNextScreen(){
              my_mc.next();
              }

              Then invoke "advanceToNextScreen()" inside the timer.
              • 4. Re: calling onPres from as
                Level 7
                crockettroth wrote:
                > Hello Bill,
                >
                > I tried it and had no success. What I normally do is encapsulate everything
                > that needs to be done into a function then simple invoke that function from
                > both locations.
                >
                > For example:
                >
                > myButton_mc.onPress = function(){
                > advanceToNextScreen();
                > };
                >
                > function advanceToNextScreen(){
                > my_mc.next();
                > }
                >
                > Then invoke "advanceToNextScreen()" inside the timer.
                >
                I needed the change in perspective. I was focused on calling the
                handler from a function instead of vise versa.
                Thanks,

                Bill