Deploying Your Interactive XML Application

Required Files
File Hosting
File Obfuscation
Embedding Your Application
Custom Video Sizes

Required Files

The following files are required to run an Interactive XML application:
  1. An .xml file containing the script for the application. Three demo .xml files ('80s Flashback Music Quiz*, Movie Date Trivia and Trivia Demo) are provided that contain many useful code examples and demonstrate best practices for coding Interactive XML. (Note: If you are using the Chrome browser, you'll have to go to View → Developer → View Source to see the code rendered correctly.)
  2. A .swf (Flash) file. This file is provided by Interactivation; the current release of the file is located here: http://www.interactivexml.net/swfs/IVXML.swf. If you choose to have Interactivation host your application and media files for free (see File Hosting below), you can simply specify the above .swf file path in the code you use to embed your application. If you choose to host your files elsewhere, you may use the above .swf file path but you will also need a cross-domain policy file (see File Hosting below). If you wish to host the .swf file elsewhere, you may download it by right-clicking here. (Important note: You may have to append ".swf" to the end of the file name when you save it.) Each release of the .swf file will be set to expire in three months, requiring that you download the latest version. (A download link is also provided on the online Interactive XML testing page.) To see when the .swf file is scheduled to expire, use the <display_version/> tag.
  3. A .htm or other (.html, .php, .asp, etc.) file to display the application on a web page. If you choose to have Interactivation host your application and media files for free (see File Hosting below), you will find a default.html file pre-populated in your allotted directory. See Embedding Your Application to learn how to configure your default.htm file.
* This is the code for the '80s Flashback Music Quiz featuring Mark Goodman (also visible on the home page of this site).

File Hosting

Due to Flash security restrictions, the .xml file must be located either:
  1. in the same domain as the .swf file or
  2. in the same domain as a cross-domain policy file enabling the .xml file to pull the .swf file from a different domain. A generic policy file you can use for this purpose is available by right-clicking here. The policy file should be placed at the root level so that any .xml file in the directory structure can make use of it.
If you choose to have Interactivation host your application and media files for free (see Free Hosting below), you need not worry about the cross-domain security problem as a copy of the policy file is located at the root level of the hosting server.

Free Hosting

In order to make it as easy as possible for you to build and deploy Interactive XML applications, Interactivation is offering free hosting of your XML code and media files.

In order to obtain free hosting from Interactivation, send an email to support@interactivexml.com with the following information:
  1. Your full name and email address.
  2. A user name for your account. The user name must no less than 5 and no more than 10 characters long. (Keep in mind that this user name will appear in the public URL for your application, so avoid personally identifiable information or inappropriate language.)
  3. Optionally, a brief description of the application(s) that you plan to build. We'd like to know what you're interested in and how we may best be able to support you.
Once your account is set up, you will receive an email with:
  1. the URL you will need to access to upload your files,
  2. your confirmed user name and
  3. your password.
Note: The hosting environment uses Apache servers, which will not run ASP (.asp) pages. If you wish to host any services in your account, they must be scripted in PHP.

File Obfuscation

You may want to obfuscate your .xml file before making it public. This will scramble the XML code so that anyone who navigates to the file location and views the page source will not be able to view it properly. This is especially useful if there are elements in your code that you don't want to reveal, such as answers to quiz questions.

To obfuscate your file, click here, copy-paste the contents of your .xml file into the window provided, and click "Encode." You will then be asked to download your code as a file with an .ivxml extension. Simply deploy this file as you would deploy your .xml file. The .swf file will correctly interpret the .ivxml extension.

Embedding Your Application

When you're ready to deploy your application, you'll need to embed it in a web page, blog post or Flash object.

Web Page

The following sample .htm file demonstrates how to embed the '80s Flashback Music Quiz:

default.htm

Select "View Source" in your browser to see the necessary code. Note that the
file path to your .xml file must be specified in two places: the FlashVars PARAM tag within the OBJECT tag and the FlashVars attribute within the EMBED tag. Feel free to use this code as a reference point for your deployments. (If you choose to have Interactivation host your application and media files for free, you will find a default.htm file pre-populated in your allotted directory.)

Blog Post

The following code demonstrates how to embed an application in a blog post (also using the '80s Flashback Music Quiz):

<div style="text-align: center;">
<embed align="middle" allowscriptaccess="always" flashvars="ContentFile=http://www.frixxer.com/ivxml/MG0001/MG0001.xml&version=cold" height="250" name="flashinterface" quality="high" src="http://www.interactivexml.net/swfs/IVXML.swf" type="application/x-shockwave-flash" width="300" wmode="transparent"></embed></div>

You can copy-paste the above code as HTML in a blog post, replacing the ContentFile and (if necessary) src values with the correct ones for your application.

Flash Object

You can easily load an Interactive XML application into your Flash project using Flash's Loader object. This will load the IVXML .swf file as an object and add Interactive XML to your screen. APIs allow the hosting application to start the experience, gather metrics, gather event information and resume execution after an event.

The ActionScript to load Interactive XML as an object is as follows:

var swfLoader:Loader = new Loader();

swfLoader.load(new URLRequest("../IVXML Source/IVXML_v1.1.20.swf?ContentFile=NOLOAD"));

(Note: ContentFile is set to "NOLOAD" so the developer screen doesn't come up.)

For the Flash project to interact with the Interactive XML, four APIs can be defined in the Flash project:
  1. start(XML_TO_EXECUTE) – Takes the name and location of the .xml file as a string. Use this when ContentFile is set to "NOLOAD" as described above (alternatively, ContentFile can be set to the name and location of the .xml file).
  2. registerEventCallback(EVENT_FUNCTION) – Takes the function defined in the <type> tag (see below) as a parameter and calls the function when an <event> tag is encountered in the .xml file. The function passed as EVENT_FUNCTION must take a single string parameter.
  3. registerMetricCallback(METRIC_FUNCTION) – Takes the function defined in the <metric> tag (see below) as a parameter and calls the function when an <metric> tag is encountered in the .xml file. The function passed as METRIC_FUNCTION must take a single string parameter.
  4. resume() – Takes no parameters. Continues the execution from the <resume_node> defined within the <event> tag that caused the break in execution.
And two XML tags can be used in the Interactive XML application:
  1. <event> – Allows an event defined externally in a Flash project to be executed and defines the node to proceed to upon completion of the event.
  2. <metric> – Passes a function to the registerMetricCallback(METRIC_FUNCTION) API.
As always, feel free to contact us at support@interactivexml.com for help with this or anything else.

Custom Video Sizes

The Interactive XML .swf file is set to display a video dimension of 300 x 250 pixels. If your application requires different dimensions (for example, if it is to be displayed in a standard ad unit such as a banner), please contact us at support@interactivexml.com so that we can assist you.