2 Replies Latest reply on Jan 4, 2011 12:32 PM by Jhon Carlo

    "mostRecentCuePoint" isn't perfectly in time, "elapsedTime" yes but ...

    Jhon Carlo Level 1


      I need a script that will allow me to advance the movie just in time, frame by frame, from frame 1 to frame 16, and then start again

      from 1 to 16 sound and so on. This must be done in relation to a sound file.

      I  tryed to make a script (I thank again Production Monkey for the kindly hint "mod 16")


      The script was this:



      on getModCuePoint ChannelNum

           ModCuePoint = sound (1). mostRecentCuePoint mod 16

           return ModCuePoint




      That I used in conjunction with the following:



      on GoFrameByFrame

         if value (CuePointin16) = 0 then

           go to frame "1"

         end if


         if value (CuePointin16) = 1 then

           go to frame "2"

         end if



      ...... and so on from 0 to 16 frames.



      With "sound (1). mostRecentCuePoint. I do not reached my intent because the movie is not exactly in time, but occasionally there are little annoying delays. I do not know why maybe cause of the large number of calculations that the program must perform between sound, cue point and and script.

      So I try another way:



      global  Number0   --------------movie script



      on MyNumber0

        Number0 = 0




      on MyNumberPlusFiveHundred

        Number0 = Number0 + 500




      on Loop16Frames – (inside a frame script)

        if sound (1).elapsedTime = Number0 + 500 then


          go next

          put Number0

        end if



      The "Frame Per Second" must be set to 999.



      This script execute the change of frame by frame exactly and perfectly in time.

      But if the sound end and I play it again or I stop and I play it again the script doesn't work and movie doesn't go frame by frame.

      I try this:



      on MyNumber0

        Number0 = sound(1).currentTime


      and this:



      on MyNumber0

        Number0 = sound(1).sound(2).elapsedTime




      ...and other script but I can't find a solution.

      Does anybody can show me a way?



      Thanks and sorry for my bad English.





        • 1. Re: "mostRecentCuePoint" isn't perfectly in time, "elapsedTime" yes but ...
          Production Monkey

          Here's some code I banged out. I did not test it. This is a FrameScript that should be streched accross the 16 frames you want to loop on.


          -- Audio Sync Frame Script


          property pNextChangeTime
          property pCurLoopCount
          property pStartFrame


          on beginSprite me
            pNextChangeTime = sound (1).elapsedTime + 500
            pCurLoopCount = 0
            pStartFrame = _movie.frame


          on exitFrame me
            if sound (1).elapsedTime >= pNextChangeTime  then
              pNextChangeTime = sound (1).elapsedTime + 500
              pCurLoopCount = pCurLoopCount + 1
              if pCurLoopCount = 16 then
                pCurLoopCount = 0
                go(_movie.frame + 1)
              end if
            end if

          • 2. Re: "mostRecentCuePoint" isn't perfectly in time, "elapsedTime" yes but ...
            Jhon Carlo Level 1

            Thanks a lot for your prompt reply and for the elegant script.
            Now it works much better. I have to continue testing but I expect that everything is okay.
            I'm Sorry for the extra returns of my previous post, I have write the text with another word processor, that have no returns, and then I have pasted it.


            Thank you again.