Begin with a new document and set the
size to 800x600 pixels. In the 'Data Components' section of the 'Components' menu
drag and drop an 'XMLConnector' anywhere on to the stage (it doesn't matter where
you put it as it will be invisible when you run the application). Give the 'XMLConnector'
a name, for this tutorial I used 'xmlcon'. Now in the 'Component Inspector' click
the 'Schema' tab. Now we need to import the Halo 2 XML file into flash, to do
this go to your Bungie.net stats page and there should be a orange image with
'XML' on it, Right click this and choose Save Target As, save this somewhere accessible
to you. (If you do not have a Bungie.net account don't despair you can download
mine by using this link, http://www.bungie.net/stats/halo2rss.ashx?i=5185&k=1745259161,
Right click this and choose Save Target As, save this somewhere accessible to
you. Now we have our XML file go back into flash and click the 'results:XML' text
and then select the icon with a white box with a downward facing blue arrow in
the right hand section of the 'Schema' section. When prompted locate the XML file
we just saved and open it. There should now be 18 objects imported. Now click
onto the 'results:XML' text again and change its 'read only' value to 'true',
(this should change all the double pointed arrows to single pointed ones). Ok,
now the first part of the XML has been configured, we will finish it off later.
Now we can build the form itself. Start off by dragging a 'List' component and
4 'TextArea' components on to the stage. Re-size the 'List' to take up the upper
left quarter of the stage, one of the 'TextArea' boxes to take up the lower half
of the stage and the other 2 'TextArea' boxes in the upper right quarter. Chang
the the instance names for the components to as follows:
'List' - game_list
'TextArea' in the lower half - game_description
'TextArea' in the top upper right quarter - main_title
'TextArea' in the middle upper right quarter - game_title
'TextArea' in the lower upper right quarter - game_link
Also change the 'html' value to true
for the 'game_description' and the row height for the 'game_list' to '20'.Next
to bind the XML to the form. Select the 'XMLConnector' and the 'Bindings' tab
in the 'Component Inspector'. Click the little '+' sign to bring up a dialogue
box, select 'title : String' under 'channel : Object' and click 'OK'. Now 'results.rss.channel.title'
has been added to the list, click it and then double click the white box next
to 'bound to', in this new dialogue box select 'TextArea, '
and then 'text : String', click 'OK' to confirm. Now select the '+' sign again,
this time open 'item : Array', bind this to 'List, '. The next
'+' add 'title : String' the one under '[n] : Object' tree, bind this to 'TextArea,
'. The next one you need to add is 'link : String' also under
'[n] : Object', bind this one to 'TextArea, '. And the final
one to add is 'description : String', bind this to 'TextArea, '.
Now we need to link the 'TextArea' boxes to the 'List' component, to do this
we need to select each item in the 'Bindings' list with a '[n]' in it and the
double click the white box next to 'Index for 'item'', in this box unselect
the 'Use constant value' check box, now you can select 'List, '
and then 'selectedIndex : Number' and then 'OK'. Once this is done for all 3
'TextArea' boxes (not the 'main_title' box) we can finish the XML part off.
Click the 'XMLConnector' again and there will be a box in the 'Properties' section
called 'URL', now you would think to put the Bungie.net XML URL in there but
don't, if you do the application will only work locally, not when it is uploaded
online. It won't work because of a new feature in Flash Player 6 and 7 which
requires the server hosting the XML feed (i.e. Bungie.net) to have a file called
a 'Cross Domain Policy' which they don't, or at least won't add you to. So to
overcome this we need to take the Bungie.net XML feed and output it into a new
feed, keeping all the original data intact. This is done using a simple ASP
template. Open 'Notepad' and paste this into it:
<%@language=vbscript%>
<%
dim strURL
strURL = "http://www.bungie.net/stats/halo2rss.ashx?i=5185&k=1745259161"
dim sxh
set sxh = server.createobject("MSXML2.ServerXmlHTTP.3.0")
sxh.open "GET",
strURL, False
sxh.send
response.contenttype
= "text/xml"
If sxh.status = 200
Then
response.write sxh.responseXML.xml
else
response.write ""
end if
set sxh=nothing
%>
(Note: Where if you are using your
own Bungie.net feed replace my link on line 4 of the code]
Save the file as 'halo2rss.asp' in
the same folder the flash file will be exported to.
Now back in flash enter in the 'URL'
box in the 'XMLConnector' 'Properties' menu 'halo2rss.asp', and change the 'direction'
to 'receive'.
Finally press 'Ctrl + Enter' to preview
the application, the list box should display your (or my) recent games on Halo
2, when you click any of the games it will display the information for that
game in the 'TextArea' boxes.
Well, that is that, you can now do
your own customizations to the app to tailor it to your needs.
If you experience any proplems I will try to help as much as I can.