5 Replies Latest reply on Jul 27, 2007 2:00 PM by Newsgroup_User

    Alarm

    OscarSSS
      Can somebody help me with a script that I can put in a alarm application that I am trying to developt in flash, I need kind of like an alarm set it to buzz or make a sound every hour.
      Thanks in advance!!!!
        • 1. Re: Alarm
          Level 7
          Hi OscarSSS,

          I would recommend that you download my API:
          http://www.baynewmedia.com/download/BNMAPI10.zip

          If anything brakes, I can help you out since I wrote the beast. Stick
          it into the same folder as your FLA so that the "com" folder is at the
          same level (in other words, the folder that contains your FLA contains
          the API's "com" folder as well).

          In your FLA's publish settings, go to the "Flash" panel and select the
          ActionScript Version "Settings..." button (the AS version should be 2,
          by the way). Click the + button and in the Classpath field, enter ".".
          Click all the OKs and you're ready.

          Here's the main script for your timeline (any frame will do):

          import com.bnm.BNMAPI;
          _root.BNMAPI=new BNMAPI();

          var timeBlock:Number=0;
          function watchTimer(paramObj,thread) {
          var currentTime=getTimer()-timeBlock;
          var elapsedSeconds=(currentTime/1000);
          trace ('Seconds Elapsed: '+elapsedSeconds);
          //This is one hour intervals. Adjust as required.
          if (elapsedSeconds>=3600) {
          trace ('ALARM!');
          //Replace this with the sound you actually want to play
          var MP3Path:String="myAlamSound.mp3";
          API.startAssetLoad({path:MP3Path,stream:true,target:this});
          timeBlock=currentTime;
          }//if
          }
          //Add the loop
          API.addThread({func:watchTimer,context:this,clockDivider:20});
          //AAnd start the show
          API.startThreads();

          Good luck!

          Patrick

          OscarSSS wrote:
          > Can somebody help me with a script that I can put in a alarm application that I
          > am trying to developt in flash, I need kind of like an alarm set it to buzz or
          > make a sound every hour.
          > Thanks in advance!!!!
          >

          --
          http://www.baynewmedia.com
          Faster, easier, better...ActionScript development taken to new heights.
          Download the BNMAPI today. You'll wonder how you ever did without it!
          Available for ActionScript 2.0/3.0.
          • 2. Re: Alarm
            kglad Adobe Community Professional & MVP
            as2 or as3?
            • 3. Re: Alarm
              Level 7
              2.0 -- 3.0 is almost ported, just a few outstanding items I need to work
              out. For you though, I doubt you'd need it (I know you've been on these
              forums a while and your experience speaks for itself). It makes a few
              things easier but if you're like me, you like to have FULL CONTROL!

              I'm adding Papervision 3D and JSON classes as well as SVG import so
              maybe there is something you can get out of it. Eh...I ramble :)

              Patrick

              kglad wrote:
              > as2 or as3?

              --
              http://www.baynewmedia.com
              Faster, easier, better...ActionScript development taken to new heights.
              Download the BNMAPI today. You'll wonder how you ever did without it!
              Available for ActionScript 2.0/3.0.
              • 4. Re: Alarm
                OscarSSS Level 1
                Thanks you Patrick I am going to check it out, I'll let you know if I need some help.
                Thank you very much.
                • 5. Re: Alarm
                  Level 7
                  No sweat. You don't absolutely have to do it this way. You can create a
                  timer and stream your own sound...it's just a bit more involved so this
                  was my way of being lazy.

                  Good luck,
                  Patrick

                  OscarSSS wrote:
                  > Thanks you Patrick I am going to check it out, I'll let you know if I need some help.
                  > Thank you very much.

                  --
                  http://www.baynewmedia.com
                  Faster, easier, better...ActionScript development taken to new heights.
                  Download the BNMAPI today. You'll wonder how you ever did without it!
                  Available for ActionScript 2.0/3.0.