13 Replies Latest reply on Sep 4, 2010 12:07 PM by kglad

    A second monitor timer hmmm....

    Samji_B

      Hey guys,

       

      I have been looking at timer samples and scripts and want to use them in a scenario in my local area.

       

      BUT I want to open up the timer on the first monitor, choose say a 30 sec timer, and press a button that will send the actual timer to the second monitor (a projector).

       

      THEN I want it to say "STOP!" and allow me on the first monitor to either alter the time or run the timer again without having to bring my mouse onto the second screen which doesn't look good!

       

      I have the idea.... but don't know a thing about code

       

      Any help would be FANTASTIC!!

       

      Samji

        • 1. Re: A second monitor timer hmmm....
          kglad Adobe Community Professional & MVP

          you'll have 2 swfs running at the same time on the same client and you want to communicate between the two?  if yes, use the localconnection class.

          1 person found this helpful
          • 2. Re: A second monitor timer hmmm....
            Samji_B Level 1

            that sounds right with one controlling the other

             

            cheers for the quick response

             

            any more ideas on how to use the local connection class or how you think the system would work out would be... FANTASTIC!!

             

            Samji

            • 3. Re: A second monitor timer hmmm....
              kglad Adobe Community Professional & MVP

              i can't tell how you want this to work so i'm unable to determine exactly how it should be coded.

              • 4. Re: A second monitor timer hmmm....
                Samji_B Level 1

                alright then I'll break it down.

                 

                In the first SWF I want to type in what time I want the timer to start from.

                 

                I then press a button which causes the second SWF to appear in the second monitor

                 

                and play the countdown timer from the specified time when I press the play symbol in the first SWF

                 

                When the time is up I want it to display "STOP!"

                 

                I then want to use the first SWF to choose whether to restart the timer with the original time/change the specified time/close down (or minimise) the second SWF

                 

                I have the timer code below:

                 

                 

                this.onEnterFrame = function() {

                 

                     var today:Date = new Date();

                     var currentYear = today.getFullYear();

                     var currentTime = today.getTime();

                 

                 

                     var targetDate:Date = new Date(currentYear,11,25)

                     var targetTime = targetDate.getTime();

                 

                 

                     var timeLeft = targetTime - currentTime;

                 

                 

                     var sec = Math.floor(timeLeft/1000);

                     var min = Math.floor(sec/60);

                 

                     sec = String(sec % 60);

                     if (sec.length < 2) {

                          sec = "0" + sec;

                     }

                     min = String (min % 60);

                     if (min.length < 2) {

                          min = "0" + min;

                     }

                 

                     var counter:String = min + ":" + sec;

                     timer_txt.text = counter;

                }

                 

                I have also got two SWF's that have been conected by the localconnection class;

                SENDER code:

                 

                sending = new LocalConnection();

                 

                myButton.onPress = function(){

                     sending.send("myConnection","displayMessage",myMessage.text);

                }

                 

                sending.onStatus = function(infoObject:Object){

                     statusMessage.text = infoObject.level;

                }

                RECIEVER CODE:
                receiving = new LocalConnection();
                receiving.displayMessage = function(receivedMessage){
                     myMessage.text = receivedMessage;
                }
                receiving.connect("myConnection");
                ------------------------------------------------------------------------------------------ ----------------------
                Does this help?

                • 5. Re: A second monitor timer hmmm....
                  kglad Adobe Community Professional & MVP

                  the first problem is:

                   

                  I then press a button which causes the second SWF to appear in the second monitor

                   

                  you can't control where a 2nd swf will be displayed beyond a pixel local.  so, if your display spans 2 monitors you can control where a new window opens using javascript.

                   

                  but you have no way to determine if a user has 2 displays and if they do whether their displays are independent or they have one display that spans two monitors.

                  • 6. Re: A second monitor timer hmmm....
                    Samji_B Level 1

                    the two SWF's are not intended for the internet, they would only be used on one computer which is linked to a projector

                    • 7. Re: A second monitor timer hmmm....
                      kglad Adobe Community Professional & MVP

                      and, are they independent displays or do the span one display?


                      • 8. Re: A second monitor timer hmmm....
                        Samji_B Level 1

                        the projector acts as the extended desktop so I'd say it spans one display

                        • 9. Re: A second monitor timer hmmm....
                          kglad Adobe Community Professional & MVP

                          is the swf that's opening the second window being displayed in a web browser so you can use javascript?

                          • 10. Re: A second monitor timer hmmm....
                            Samji_B Level 1

                            if its easier, yeah that could be possible

                            • 11. Re: A second monitor timer hmmm....
                              kglad Adobe Community Professional & MVP

                              then use the externalinterface class to call a javascript function (in your hmtl) that uses the window.open() method.  you can position the window to your first monitor using javascript.

                              • 12. Re: A second monitor timer hmmm....
                                Samji_B Level 1

                                i've never used Java so how do I go about it?

                                • 13. Re: A second monitor timer hmmm....
                                  kglad Adobe Community Professional & MVP

                                  you can use google to look for javascript snippets.  but javascript is not the same as java so search for javascript.