3 Replies Latest reply on Dec 3, 2012 12:10 PM by Sean_Wilson

    What's wrong with this script?

    GRAMOPHONE Level 1

      Hi,

      First, this was written in Macromedia.Director.MX.2004. Now, trying to make an upgrade to 11.5 when I saved and run this, it says it can't divide by zero and the line

      it points out is "percentPlayed = pCurrentTime / float(pDuration)"

       

      This script is a moving bar in a audio player as a curret time indicator.

       

       

      on startBar1

        global pSprRef,

        global pLeft,

        global pRight,

        global pCurrentTime,

        global pDuration,

        global pSoundChannel,

        global pSoundMember,

        global pSoundChannelNum,

       

        pSprRef = sprite("MovingBar")

        pLeft = sprite("MovingBarBack").left

        pRight = sprite("MovingBarBack").right

        pCurrentTime = 0

        pSoundMember = sound 1

        pDuration = sound(1).endTime

        pSoundChannel = sound(1)

        if pSoundChannel.isBusy() then

          pCurrentTime = pSoundChannel.currentTime

          percentPlayed = pCurrentTime / float(pDuration)

          newLocH = ((pRight - pLeft) * percentPlayed)

          pSprRef.width = newLocH

          sprite(39).locH = sprite(28).right

        end if

      end

       

       

       

      I would really appreciate any help.

       

      Thanks