On 3/24/2015 10:26 AM, Richard Gaskin wrote:
In apps where the media I'm playing resides in a single folder, I often
just have a central handler cover that to which I pass the file's short
name only and it takes care of the rest, e.g.:

on PlayMovie pFile
   put specialFolderPath("documents")&"/MyApp/media/"& pFile into tPath
   if there is not a file tPath then
      answer "Media file missing: "& tPath
      exit to top
   end if
   play tPath
end PlayMovie

That's exactly what I do too, I've never trusted relative paths. I use this method for all file types, not just movies, but I turn it into a function so I can call it for any kind of file:

function pathToFile pName
  put specialFolderPath("documents")&"/MyApp/media/"& pName into tPath
  return tPath
end pathToFile

This works great and is portable everywhere. If there are several folders involved, I use a switch statement inside the function, or else pass the folder and file names both in the parameters.

--
Jacqueline Landman Gay         |     jac...@hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to