2 Replies Latest reply on Mar 8, 2009 2:53 PM by TC Media

    dynamic video import on run-time

    TC Media
      Hi everyone,

      I'm trying to adjust a lingocode to import video files instead of images into a cast. So that users can change the video playing to one of their own videos and save the reference in a castlib.
      But the stage only displays an windows media image showing that it is a windows media cast member but doesn't actually play a video as it doesn't contain the path to the video file

      The new code;
      On MouseDown
      fio = xtra("FileIO").new()
      file = fio.displayOpen()
      fio = void
      newMember = new(#windowsmedia)
      newMember.fileName = file
      sprite(3).member = newMember
      newMember.duplicate(52, "media")
      end

      I use the last line (newMember.duplicate(52, "media") to copy the newly created cast member into an external cast (media) and specific member (52) number. This so the external cast containing the imported media reference can be saved by an "save" button. And be accesed by about 9 other movies.


      What am I missing here to make dynamic video import work? any pointers?
        • 1. Re: dynamic video import on run-time
          Level 7
          > On MouseDown
          > fio = xtra("FileIO").new()
          > file = fio.displayOpen()
          > fio = void
          > newMember = new(#windowsmedia)
          > newMember.fileName = file
          > sprite(3).member = newMember
          > newMember.duplicate(52, "media")
          > end

          Works for me - except for the member duplication. As suggested in the
          other forum you posted to, it would be better *not* to use key words as
          variable names (like 'file' and 'newMember').
          It's not clear why you create a new member in castLib(1) and link it to
          sprite(3) only to then duplicate it to a different castLib. Why don't
          you start with a #windowsMedia member in slot 52 of castLib("media") and
          simply change its filename property?
          --
          on mouseDown me
          tMember = member(52, "media")
          if tMember.type = #empty then
          tMember = _movie.newMember(#windowsMedia, tMember)
          -- tMember.name = "WMV"
          end if
          fio = xtra("FileIO").new()
          tFile = fio.displayOpen()
          fio = VOID
          tMember.fileName = tFile
          sprite(3).member = tMember
          end
          • 2. Re: dynamic video import on run-time
            TC Media Level 1
            Strange that the member duplication doesn't work for you as it does for me but I'm using director 11 so that could be the reason.

            As for using keywords, well, as I'm almost completely new to lingo scripts myself it was a code that I found and used to import graphics into the cast during run-time.
            I tried adjusting the script to import the graphics directly into a external cast member but I couldn't get it to (looks away embarrassed). Hence the duplication part of the script.


            Anyway, many many thanks for explaning and even providing a sample code. It works exactly as what I tryed to program.