7 Replies Latest reply on Aug 1, 2013 11:37 AM by kglad

    AS2: Local Connection - Pause and Play Videos

    copperstick

      I have two exe's, they are a mock-up of a control system....one is the controler that sends commands through LocalConnection to the other which simply plays video of what would be happening when certain buttons are pushed on the controler. I got it working with this code (with help I got here):

       

      sending_lc = new LocalConnection();


      pmvopen1.onRelease = function() {
      this._parent.gotoAndStop(3);
      trace(this+" clicked");
      sending_lc.send("my_lc_as2", "gotoF", 2);
      }


      pwvopen1.onRelease = function() {
      this._parent.gotoAndStop(6);
      trace(this+" clicked");
      sending_lc.send("my_lc_as2", "gotoF", 4);
      }

      chokeclose4.onRelease = function() {
      this._parent.gotoAndStop(25);
      trace(this+" clicked");
      sending_lc.send("my_lc_as2", "gotoF", 15);
      }

      forward1.onRelease = function() {
      this._parent.gotoAndStop(3);
      trace(this+" clicked");
      sending_lc.send("my_lc_as2", "gotoF", 2);
      }

      reverse1.onRelease = function() {
      this._parent.gotoAndStop(1);
      trace(this+" clicked");
      sending_lc.send("my_lc_as2", "gotoF", 0);
      }

      reset.onRelease = function() {
      this._parent.gotoAndStop(1);
      trace(this+" clicked");
      sending_lc.send("my_lc_as2", "gotoF", 0);
      }

       

      pause1.onRelease = function() {

      this._parent.pmvOpen.pause; (parent needs to pause flv movie pmvOpen as well as 2 object movies)

      trace(this+" clicked");

      sending_lc.send("my_lc_as2", "gotoF", 1); (this need to send a command to pause one flv movie)

      }

       

       

      What I need to do is add a function to the above code that will pause all flv movies in both the sender and reciever (one flv movie each) and pause all object movies on the sender when the pause1 button is pressed.

       

      The parent needs to pause 1 flv movie and 2 object movies and I need to SEND a command to the other exe to pause one flv movie.

       

      I started the code but, of course, it doesnt work...the button is active as I get a trace...My attempt to start this is in red at the end of the code above. 'pmvOpen' is the name of the flv movie on the parent and I don't know HOW to begin pausing the other movie called 'pmvOpen1' through LocalConnection or to pause the 2 object movies called 'Chart1' and 'Chart2' on the sender.

       

       

      on(press)
      {
      chart1.stop();
      }

       

      on(press)
      {
      chart2.stop();
      }

       

      on(press)
      {
      pmvOpen.pause();
      }

      ^^ this is how I had it doing the pause before the requirement to have a second screen. This was simply attached to the pause button...I still need to pause all of the above but also I need to pause a movie through local connection at the same time.

       

      This is my last step before I finish and if I can get help on the pause I think I can do the play button without any additional help. Just not sure where to start with this.

       

      Thanks

        • 1. Re: AS2: Local Connection - Pause and Play Videos
          kglad Adobe Community Professional & MVP

          to start, if pmvOpen is your flvplayback component on the _parent timeline, you should use:

           

          pause1.onRelease = function() {

          this._parent.pmvOpen.pause();

          trace(this+" clicked");

          sending_lc.send("my_lc_as2", "gotoF", 1); // it doesn't look like this would pause an flv in the receiving app

          }

          1 person found this helpful
          • 2. Re: AS2: Local Connection - Pause and Play Videos
            copperstick Level 1

            Okay, for the first function I did the usual, I forgot to put my open and close parens. This is what I have:

             

            pause1.onRelease = function() {

            this._parent.pmvOpen.pause();

            this._parent.chart1.stop();

            this._parent.chart2.stop();

             

            which works fine. I just can't figure out the right syntax to get the flv in the reciever to pause I have tried:

             

            sending_lc.send("my_lc_as2", pmvOpenl.pause);

            }

             

            sending_lc.send("my_lc_as2", "pause", pmvOpenl);

            }

             

            and pretty much every variation of this...the movie is pmvOpenl

             

            Code hint gives me:

             

            Sending("target","method"...

             

            just not sure the right way to call this out.

            • 3. Re: AS2: Local Connection - Pause and Play Videos
              kglad Adobe Community Professional & MVP

              you need a function in your receiving app that's registered to the localconnection and that pauses that receiving app video.  what is that function?

               

              if it's pauseF, use

               

              sending_lc.send("my_lc_as2","pauseF");

               

              if that fails, copy and paste the code defining the pause function in the receiving app and the code that registers that function to the receiving lc.

              • 4. Re: AS2: Local Connection - Pause and Play Videos
                copperstick Level 1

                I forgot about the recieving end code.

                 

                so my controler end code would look like this:

                 

                pause1.onRelease = function() {

                this._parent.pmvOpen.pause();

                this._parent.chart1.stop();

                this._parent.chart2.stop();

                  trace(this+" clicked");

                sending_lc.send("my_lc_as2", "pauseF");

                }

                 

                 

                My recieving code as it is right now is:

                 

                receiving_lc = new LocalConnection();

                receiving_lc.gotoF = function(n:Number){
                trace("received "+n);
                    gotoAndPlay(n);

                }

                receiving_lc.connect("my_lc_as2");

                 

                 

                This is recieving for my frame forwarding. So I would need to put a new function in this that calls out the video. To call out the video to be controled would it look something like:

                 

                receiving_lc = new LocalConnection();

                receiving_lc.gotoF = function(n:Number){
                trace("received "+n);
                    gotoAndPlay(n);

                }

                 

                receiving_lc.pauseF = function(pause){
                     pmvOpenl.pause(n);

                }

                 

                receiving_lc.connect("my_lc_as2");

                 

                This seems to work...I will try to do it with another video on another frame and see what happens. Thanks a bunch man. If this works down the line I think I might have this.

                • 5. Re: AS2: Local Connection - Pause and Play Videos
                  kglad Adobe Community Professional & MVP

                  close, except you're not passing a parameter to pauseF. so, use:

                   

                  receiving_lc.pauseF = function(){
                       pmvOpenl.pause();

                  }

                   

                  or if you had a pause/play function you might use something like:

                   

                  receiving_lc.pausePlayF = function(s:String){

                  if(s=="pause"){
                       pmvOpenl.pause();

                  } else if(s=="play"){

                  pmvOpenl.play();

                  } else {

                  //etc

                  }

                  }

                  1 person found this helpful
                  • 6. Re: AS2: Local Connection - Pause and Play Videos
                    copperstick Level 1

                    Okay, I see. Oddly enough it worked the way I had it but I will go back and correct it. Once again, thanks a bunch for all your help on this. It was invaluable.

                    • 7. Re: AS2: Local Connection - Pause and Play Videos
                      kglad Adobe Community Professional & MVP

                      you're welcome.

                       

                      and yes, as2 does very little error correction.