XML into Flash

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AutumnsDecay
    New Member
    • Mar 2008
    • 170

    XML into Flash

    Hey there.

    I have been given an XML document and have been asked to create a Flash object that uses the variables in the XML document to generate the output.

    The project is for a weather data feed which is created by the weather network (Canada). They have provided an XML file and a set of icons to display weather it's snowing, raining, sunny, etc.

    Here is what the tags look like:

    Code:
    <PERIOD ID="2" DATE="04/01/2009 18:00" NAME_EN="This afternoon" ICON="a" FORECAST_TEXT_EN="Isolated showers" TEMPERATURE="10" POP="90" />
    As you can see it gives the ICON name (ICON="a") and a bunch of other information in the tag. I need to be able to have Flash grab the info in that tag (string) and generate it. The XML is to be stored remotely on the weather network's server, which will be updated every 6 hours, according to our rep.

    We have four cities in the XML document (as we have four locations of business). We need to be able to tell Flash which location it is currently, hard-coded.

    Here is the code for a complete location:

    Code:
    <SITE NAME_EN="Kingston" PROV_EN="Ontario" COUNTRY_EN="Canada" LOCATIONID="CAON0349">
    		<OBS DATE="04/01/2009 08:00" ICON="b" FORECAST_TEXT_EN="Partly cloudy" TEMPERATURE="6" WIND_CHILL="N/A" WIND_SPEED="13" WIND_DIR="SE" />
    		<PERIOD ID="2" DATE="04/01/2009 18:00" NAME_EN="This afternoon" ICON="r" FORECAST_TEXT_EN="Light rain" TEMPERATURE="6" POP="90" />
    		<PERIOD ID="3" DATE="04/02/2009 00:00" NAME_EN="This evening" ICON="an" FORECAST_TEXT_EN="Scattered showers" TEMPERATURE="5" POP="90" />
    		<PERIOD ID="4" DATE="04/02/2009 06:00" NAME_EN="Tonight" ICON="an" FORECAST_TEXT_EN="Isolated showers" TEMPERATURE="2" POP="40" />
    		<PERIOD ID="5" DATE="04/02/2009 12:00" NAME_EN="Thursday morning" ICON="h" FORECAST_TEXT_EN="Mainly sunny" TEMPERATURE="4" POP="0" />
    		<WEEKDAY ID="2" DATE="04/02/2009 12:00" NAME_EN="Thursday, Apr  2" ICON="h" FORECAST_TEXT_EN="Mainly sunny" HIGH_TEMP="9" LOW_TEMP="2" />
    		<WEEKDAY ID="3" DATE="04/03/2009 12:00" NAME_EN="Friday, Apr  3" ICON="r" FORECAST_TEXT_EN="Light rain" HIGH_TEMP="11" LOW_TEMP="7" />
    		<WEEKDAY ID="4" DATE="04/04/2009 12:00" NAME_EN="Saturday, Apr  4" ICON="r" FORECAST_TEXT_EN="Cloudy with showers" HIGH_TEMP="9" LOW_TEMP="3" />
    		<WEEKDAY ID="5" DATE="04/05/2009 12:00" NAME_EN="Sunday, Apr  5" ICON="h" FORECAST_TEXT_EN="Sunny with cloudy periods" HIGH_TEMP="7" LOW_TEMP="2" />
    		<WEEKDAY ID="6" DATE="04/06/2009 12:00" NAME_EN="Monday, Apr  6" ICON="r" FORECAST_TEXT_EN="Light rain" HIGH_TEMP="7" LOW_TEMP="3" />
    	</SITE>
    As you can see it's all done by location ID. How would I hard-code that into flash in order to tell it which stats to look at?

    Thanks in advance for any help I may receive!
Working...