Download Construct 2 public preview 39
Link to release 38.2
Three new plugins and a few bug fixes this build. The new plugins are Ajax, Array and Browser. See the changelog for more!
Edit 08/06/11: Some updated info on the AJAX plugin: Modern browsers prevent cross-domain requests for security reasons. This means a page on scirra.com can only request other pages on scirra.com. Another difficulty is files on disk count as a different domain too. Construct 2 previews your game from files on disk. Therefore, requesting any page from the internet will fail in preview mode, because going from disk to the internet is cross-domain too.
However, servers can be set to respond to cross-domain requests. This is generally only done for things like data services, but if the server sends this HTTP header:
Access-Control-Allow-Origin: *
then the page can be requested from any domain - other servers, or files on disk. That means it works in preview too! For example, if you are requesting your own PHP file from your own server, you can add this line to the PHP script:
header("Access-Control-Allow-Origin: *");[/code:3oe4d6vi]
This will make requests work when previewing. This makes testing it a lot easier.
The only other alternative is to export the project and upload it to your server to test the AJAX requests. That's kind of slow, so if you can get it to send out that header, that will make life easier for you.
Remember you still can't make cross-domain requests by default, even when the script is online, unless the server you are requesting also sends out an Access-Control-Allow-Origin header that allows your domain. You might be able to contact the person running the server and have them modify it so your application works, but this is only likely to work if you know them or work with them.
Hopefully that will help you make the most of the AJAX plugin. Please remember these limitations aren't Construct's fault - the internet is designed like that for security reasons, so we have to work with that.
[h2]Changelog[/h2]
[ul]
[li][Add] Browser plugin: can navigate to pages, get browser details, etc.[/li]
[li][Add] AJAX plugin: request URLs dynamically as the game runs. However, cross-domain requests are limited, and requests in preview may fail. See caveats above.[/li]
[li][Add] Array plugin: like with Classic, store arrays of values in up to three dimensions.[/li]
[li][Add] 'Edit texture' context menu option when right clicking objects with textures in a layout.[/li]
[li][Change] Upgraded bundled jQuery version from 1.4.4 to 1.6.1[/li]
[li][Fix] False-positive assert failure ("system_expression != NULL").[/li]
[li][Fix] Multiple spaces in expressions were collapsed to a single space when saved and loaded, due to an incorrect XML parser setting.[/li]
[li][Fix] Layer 'initially visible' setting was mixed up with the 'visible in editor' setting when loading a project.[/li]
[li][SDK] Runtime scripts have been refactored to be simpler and minify better. It should be a bit easier to write plugins and behaviors now, and minified runtime scripts are a few kb smaller.[/li]
[/ul]