3 Replies Latest reply on Jan 23, 2007 2:32 AM by the real POTMO

    crash using flash's Sound object

    the real POTMO Level 1
      Using this code will crash director.
      Im using Director 10.1.1

      add this to a framescript and run. wait a couple of secs and watch it crash.

      property pSound
      property pState, pStart
      property pSprite, pMember

      on beginSprite me
      put "clearASObjects"

      clearAsObjects()



      --set callbacks
      pStart = the milliseconds



      pState =#init


      end

      on exitFrame me

      case pState of
      #init:
      --create falsh object
      pSound = newObject("Sound")
      pstate =#init2

      #init2:
      setCallback(pSound, "onID3", #onID3, me)
      setCallback(pSound, "onLoad", #onLoad, me)
      setCallback(pSound, "onSoundComplete", #onSoundComplete, me)
      pState = #startDownload

      #startDownload:
      if the milliseconds - pStart > 5000 then
      pSound.loadSound(" http://pulkavm.raketspel.se/music/rosemary_clooney.mp3", true)
      -- pState =#nada
      pStart = the milliseconds
      put "start downloading"
      end if

      #buffer:
      tTot = pSound.getBytesTotal()
      tCur = pSound.getBytesLoaded()

      if voidP(tTot) then
      --put "progress N/A"
      else
      put "progress", tCur/tTot*100
      end if

      #play:
      pSound.start()
      pState = #playing

      #playing:

      end case

      go to the frame
      end



      --callbacks from flashobject
      on onID3 me, tparam
      put "inID3", tParam
      end

      on onLoad me, tSuccess
      put "load success"
      put "duration", tSuccess.duration
      put "position", tSuccess.position
      put "id3", tSuccess.id3

      pState = #buffer

      end

      on onSoundComplete me, tparam
      put "onSoundComplete", tParam
      end



      on stopMovie me
      pSound.stop()
      pSound = void
      put "clearASObjects"
      clearAsObjects()
      end