Any external files can also be imported to your project via the Project Bar. This is useful for including any other resources your project might need, such as videos, additional images, JSON data, XML data, text data, documents, or other general files you might want to let the user download.
For ideas on uses for project files and possible workflows, see the tutorial Using project files in Construct 2.
Files can be imported by right-clicking the Files folder in the Project Bar and selecting Import Files.
By default you can add any kind of file to the project, but you can also set the file filter to only show text-based files if those are the kinds of files you are looking for.
Importing project files has the following effects:
- The file is copied to your project folder, or stored inside the .capx file. (It is not referenced from its current location on disk, so if you change the original file, it is not updated in the project.)
- When previewing, the file is also accessible from the preview server (localhost), which helps you test the use of project files.
- The file is exported with your project.
- When published, the file is also cached for offline use alongside the rest of the project. For more information see the tutorial Offline games in Construct 2.
Project files can also be AJAX requested at runtime using the AJAX object's Request project file action. This is especially useful for loading XML or JSON data at runtime.
For project files to load correctly after exporting, be sure to set up the right MIME types on the server.