What is binary data?
Binary data is just data embedded in your application. When you use a Play Sound action or Play Music, unless you specify play from file and use and expression, the music/sound gets embedded in your MFA, and then your application when you build it. Flash connverts sounds to MP3, of course, and Java only supports Wav right now. But Vitalize, Screensavers, and EXEs all support binary data.

However, only screensavers and EXEs can extract your custom-included binary data. This data can be included via the Binary Tab of the Data Elements window. You can access it by clicking the button next to the event editor button. It looks like a musical note with a paper.

What does the Binary Data tab look like?
Well, it looks something or other like this:
Image

Here you can add and remove files from the list of files to include in the built application. These files are not saved with the MFA, and have to be accessed in a special way using some of MMF2's built in features. (Namely the Special Object)

When you want to use a file from here, you need to use the exact same path as is seen in this tab for it to work.

How do I use the files I have listed in the tab in my application?
Note that because the binary data files are only embedded in your built application, in some cases you might not be able to test this by simply running your application from MMF2. You have to build your application and run the file for it to work. However sometimes you can test it from MMF2. It just depends.

Once you have your binary data in the list, you can start to program your application for the files. Here is the process:


* Take note of the path of the file you want that is listed in the Data Elements' Binary Data tab. You will need to use this exact text every time you refer to the file. (I will refer to it as "{MyFile}")
(note: this path is saved in the EXE/SCR no matter what the compression. To save space and privacy, I recommend you use Windows Explorer's Map Network Drive feature. Open My Computer, go to Tools -> Map Network Drive. Select the drive letter that you want, then map it to the folder that has the file you want. Then instead of using the whole path, now you can just use, for example, Y:\File.wav)

* When you want to use the file, use the action Extract Binary File "{MyFile}" from the special object.

* When you want to reference the file for an extension or object or MMF2, or whatever, then use the expression BinFileTempName$("{MyFile}") from the special object to get the path for it.

* When you are done using the file, or your application is closing, then you should always release the file with the action Release Binary File "{MyFile}" from the special object.


And that's how you use it! This is also how the auto installer was made for Knytt Stories. The game files had to come out of somewhere!

To see a working example, check this out:
http://www.LB-Stuff.com/MMF2/BinaryDataExample.zip

Enjoy,
-LB