Spawning buttons

For questions about using Classic.

Post » Sat Jun 09, 2012 12:22 am

Hello i am trying to spawn x button on window where x is the number of sound samples in the sounds folder and make them play, can i access to the folders like this?

Thanks...
B
3
Posts: 6
Reputation: 458

Post » Sat Jun 09, 2012 1:36 am

Yes, you can. Use the "File" object. The condition "for each file" is pretty much all you need.
Create a text variable (e.g. 'soundpath') and set it to the path of your sound folder.

Then call "for each file" with that path, create a button and store the path to the current file somewhere (I would use a sprite with a pv 'filepath' as a button). When it comes to play a file linked to a button, pass the stored path to either "autoplay file" or "play music from file" of XAudio2, depending on the sound format.

Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests