Hi,
I'm trying to use Player Objects to play simple .mov sound files. I want to play them while I'm designing, working in the IDE, and then, when I create a standalone, I want them to play there.
I'm not having luck with this. If I use the "Browse..." function to relate the player to the sound file, the files don't play when I create a standalone. Presumably because the absolute path isn't converted to a relative one. Illustration:
If I input a relative path in the IDE's window, then I can get the files to play from the standalone. But they won't play within the IDE, so it's difficult to make design decisions. Illustration:
How can I get Rev to play the file in the IDE and from the standalone? Do I need to do scripting gymnastics to parse path and filenames, or is there a built-in way for this to "just work?"
Thanks,
Doug
Using player objects in IDE and Standalone
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 1336
- Joined: Sun Jul 12, 2009 10:53 am
- Location: Bordeaux, France
Re: Using player objects in IDE and Standalone
Hey Doug...
When you run this it will set the defaultFolder to the folder in which the referenced stack resides:-
Insert this code into the preOpenStack or openStack handler, and then files that reside in the same folder as the stack can be accessed by using the relative path to the file.
If you use this under MacOSX in a standalone application, the defaultFolder will be set to a folder inside the application package.... for example.... myApp.app/Contents/MacOS. If you don't set the defaultFolder in the standalone, it will be set to the folder containing the application package.
be well
Dixie
When you run this it will set the defaultFolder to the folder in which the referenced stack resides:-
Code: Select all
set itemDel to "/"
put item 1 to -2 of (the effective fileName of this stack) into theDefaultFolder
set the defaultfolder to theDefaultFolder
If you use this under MacOSX in a standalone application, the defaultFolder will be set to a folder inside the application package.... for example.... myApp.app/Contents/MacOS. If you don't set the defaultFolder in the standalone, it will be set to the folder containing the application package.
be well
Dixie
Re: Using player objects in IDE and Standalone
Dixie,
Thank you for the quick reply!
Incorporating the code you provided, I was able to manually enter relative references to load sounds into Player objects in the IDE, and have them play in the IDE.
When I went to make the standalone, I commented out the code, saved the stack, and built the standalone. The sounds linked correctly to the Player objects.
So just to confirm, am I correct in following that procedure... using the code while I'm working in the IDE, and then commenting it out before building the standalone?
Also, will this approach work for standalones built for Windows?
Thanks,
Doug
Thank you for the quick reply!
Incorporating the code you provided, I was able to manually enter relative references to load sounds into Player objects in the IDE, and have them play in the IDE.
When I went to make the standalone, I commented out the code, saved the stack, and built the standalone. The sounds linked correctly to the Player objects.
So just to confirm, am I correct in following that procedure... using the code while I'm working in the IDE, and then commenting it out before building the standalone?
Also, will this approach work for standalones built for Windows?
Thanks,
Doug