I'm looking for any knowledge on how to producse weather content similar to AccuWeather's SWF modules.
http://www.accuweather.com/adc2004/p...e.asp?header=m
Can anyone point me in the right directoin?
~ Brian
Printable View
I'm looking for any knowledge on how to producse weather content similar to AccuWeather's SWF modules.
http://www.accuweather.com/adc2004/p...e.asp?header=m
Can anyone point me in the right directoin?
~ Brian
First thing you should do is go to weather.com and sign up for their affiliate program to use their xml feeds for daily weather.
Then, it's a matter of what you specifically want to do with them. Do you want users to search for their area? Do you want a five day forecast?
Thanks for the reply. I need a 7 day GRAPHICAL forcast. I can do the text feeds, but I'm really in need of one with graphics - that will auto update (sun, rain, clouds).
Any help?
Yes, the weather channel feeds include their own graphics in them.
Go to http://xoap.weather.com/services/oap...homewxanywhere and sign up. I believe that's still the link for getting syndicated with weather.com (I'm not sure since it's been years since I got my account). They will set you on the right path to syndicating weather feeds.
Then, it's simply pulling the nodes from the feeds (requires a working knowledge of xml). It should look something like this:
The <icon> tag, when you display it, will have to be appended with .jpg or .gif. That determines the weather image displayed. Each number corresponds with a particular weather condition. Like say 30 was for Sunny, then your 30.jpg image would be of a sun.Code:<icon>30</icon>
They suggest that you use their weather icons that you get when you sign up with the service, but I've seen many who do it with their own custom made icons. Just make sure you include the Weather.com logo on your site or you'll get booted from the system.
It's actually for digital signage. I need the forcast to be 1024 x 768???
Doesn't matter what the size is. You're using the xml file to feed the data into your display page. You make the page any size you want. You can make the weather images any size you want.
The xml feed from weather.com just gives you the raw data ... time, day, wind, sunrise, sunset, AND the <icon> tag corresponds with the weather type. You need to parse the xml.
For example, if you'll get an xml file similar to this:
You would take this data from the xml and place it anyway you like in your digital display. And again, the <icon> tag designates what image is associated with the weather conditions. You will have to append .jpg to the end of the number when you display it. You could even make your own and append .swf to the end to have a sun with moving clouds or rain with drops coming down (although I imagine the load time would be slower).Code:<day>Thurs</day>
<icon>25</icon>
<srise>5:40AM</srise>
<sset>8:34PM</sset>
This is an old one (hope it still works) that isn't complete, but should show you basically what the idea is:
http://www.webchannel24.com/Weather/
Again, that link is under construction but you should be able to see a graphical weather display.
Is this for one location or are you displaying weather for more than one city/area?
I'm not too sure on the extent of your xml or (if you're doing this in flash) actionscript knowledge, but when you get the xml, feel free to respond here and I'll help you along with pulling out the information from the xml feed. Once you understand how to pull the info, it's really not hard at all.
Villian,
Thanks for the quick replies. I'm doing this in flash - as the file needs to be [SWF], however I've worked with XML and RSS feeds in websites before. I just don't even know where do start when getting these graphics to change. Do you know if there are any examples out there?
~ Brian
Ya - that link didn't work. An no - I will just be displaying the 7-day forcast for the entire state of Minnesota.
Sorry about the link.
I don't think I'm explaining this correctly.
when you get the xml file from the weather channel, THEY update the feed several times a day. That means, the <icon> tag will change if the weather changes.
For instance, at 2:30pm the weather could be cloudy, and the icon tag is <icon>22</icon>. Then, when weather.com updates the xml feed at 2;45pm, it could be clear, which then the icon would be <icon>26</icon>.
They give you the graphics. All you have to do is put them in a folder and when you call the xml in your flash movie, append ".jpg" to the end.
example:
Draw loader boxes on your movie frame where the xml is loaded and call the loader boxes "Icon0", "Icon1", "Icon2" and so on for all seven days.
Parse the xml through the usual actionscript method
When you're pulling the images, you would do it like this:
Now, since you're doing a stand alone kiosks, you'll have to have a refresh script that will reload the xml every ten minutes or so. When the xml feed is updated by weather.com, your images will change (if the weather conditions change) and your information will be updated on each refresh.Code:this.ref["Icon"+i].loadMovie("icon_folder/"+subnodes[5].firstChild.toString()+".jpg")
Here is an example where you can see there are five loader boxes:
http://www.webchannel24.com/images/weather_test.jpg
Wow - that looks really good. Would you be willing to send me your original code? I'd like to see how this all works..
~ Brian
I'm wondering if I couldn't build a 7 day forcast out of flash - similar to the one you've built in HTML?
That was done in Flash btw.
I never send out my full code, but I can help you with yours. Again, start by getting a rss account with the weather channel.
villain2,
I was wondering if you have you use any crossdomain files or System.security.allowDomain() code in your actionscript. I made an account on weather.com and recieved an id and key. However, I am having errors loading the weather.com data into flash. I used a basic xml method to load the url. It works fine if I run the .swf locally from my machine, but was it is uploaded, the xml will not load.
Any ideas?
Use a proxy script on your own domain to load the xml data from the weather.com site.
For example, in php it would be:
Name this file weather_proxy.php or whatever.PHP Code:$dataURL = "http://www.weather.com/your_weatherchannel_account_address";
//note that this will not follow redirects
readfile($dataURL);
Then, write your actionscript to read the xml from that file. This gets around the need to write a security.allowDomain script.
Is there any demo or fla file to look at? So I can understand it better?
Has anyone ever managed to make anything like this?... Im starting to dubt..
I have been googeling for many hours and have asked almost everywhere.. But... nothing.. can anyone help a bit more whit this problem? plz.
I'm not one for displaying my source code online, but we can go through how to set this up. First and foremost, get a weather feed from Weather.com or Accuweather. Then, write the proxy code as seen above so you can use the xml on our flash site.
From there, it's an understanding of how to load xml data into your flash movie (which there are tons of tutorials on that online).
For searching by zipcode, you will need an understanding of LoadVars to sendAndLoad data from your flash front end that will rewrite the source proxy file. (ie. if there is a space for zipcode in the xml file address you get from weather.com - which there is - you can send the zipcode the user inputs as part of the proxy script code).
Let me know where you are with this project and we can go from there.
for reference:
http://webchannel24.com/index.php?co...her/#/Weather/
Here's a rough example of a weather feed in flash. Just enter in your zipcode and click on send.
I must have a autoupdate weather. With a pre entered zip code.
So the weather just shows. And nothng more.
do you have that?
Then you just use the zipcode you want in the proxy file. Perhaps you should sign up for a weather feed service first and then go from there (accuweather or weather.com).
okay, thank you. Now i have a xml. I get one from www.storm.no every day now. here is the xml file.
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <wod>
- <pointforecast>
<name>OSLO</name>
<datetime>20050929080000</datetime>
<winddirection>138</winddirection>
<windspeed>4</windspeed>
<cloudcover>75</cloudcover>
<temperature>8</temperature>
<prec06>0</prec06>
<mslp>1005</mslp>
<symbol>4</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20050929140000</datetime>
<winddirection>171</winddirection>
<windspeed>4</windspeed>
<cloudcover>70</cloudcover>
<temperature>11</temperature>
<prec06>1</prec06>
<mslp>1004</mslp>
<symbol>9</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20050929200000</datetime>
<winddirection>258</winddirection>
<windspeed>1</windspeed>
<cloudcover>92</cloudcover>
<temperature>9</temperature>
<prec06>3</prec06>
<mslp>1006</mslp>
<symbol>9</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20050930080000</datetime>
<winddirection>352</winddirection>
<windspeed>3</windspeed>
<cloudcover>30</cloudcover>
<temperature>8</temperature>
<prec06>0</prec06>
<mslp>1014</mslp>
<symbol>2</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20050930140000</datetime>
<winddirection>184</winddirection>
<windspeed>2</windspeed>
<cloudcover>79</cloudcover>
<temperature>9</temperature>
<prec06>0</prec06>
<mslp>1015</mslp>
<symbol>4</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20050930200000</datetime>
<winddirection>148</winddirection>
<windspeed>4</windspeed>
<cloudcover>98</cloudcover>
<temperature>9</temperature>
<prec06>1</prec06>
<mslp>1011</mslp>
<symbol>9</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20051001140000</datetime>
<winddirection>187</winddirection>
<windspeed>3</windspeed>
<cloudcover>99</cloudcover>
<temperature>13</temperature>
<prec06>2</prec06>
<mslp>1001</mslp>
<symbol>9</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20051002140000</datetime>
<winddirection>77</winddirection>
<windspeed>1</windspeed>
<cloudcover>6</cloudcover>
<temperature>12</temperature>
<prec06>0</prec06>
<mslp>1016</mslp>
<symbol>1</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20051003140000</datetime>
<winddirection>213</winddirection>
<windspeed>2</windspeed>
<cloudcover>79</cloudcover>
<temperature>14</temperature>
<prec06>0</prec06>
<mslp>1018</mslp>
<symbol>4</symbol>
</pointforecast>
</wod>
okay, heres my question, How can flash understand that file? Do I have to use a ton of "booleans"? :mrt: And how do I tell movieclips to show and "hide" if or ifnot there is rain or snow?? Im having a bit of hard time to understand this but I wont give up. Meanwhile I would love to get some support from this forum. Thanks in advance
ups_ dubblepost
You will need to load the XML file into flash using actionscript:Quote:
Originally Posted by infralilla
After success is where you sort out which nodes you are displaying. I would search through google on "parsing xml with actionscript" or "xml and flash". There are tons of tutorials out there.Code://Create the XML Object
myXML = new XML()
myXML.ignoreWhite = true
//Load XML file
myXML.load("location of your xml file.xml")
//Make a reference to current timeline
myXML.ref = this
// Parse XML and fetch
myXML.onLoad = function(success){
You're basically going to set up text fields to read from specific nodes of the loaded xml file. That will display the info on the page.
For your rain or snow, you would have do write an if statement, like:
Or something to that effect It depends on what you're trying to do specifically. Again, I would look up some tutorials online to get a better understanding.Code:if(weather_conditions.txt != "rain"){
loadMovie("noobject.jpg", weatherholderLoader);
} else {
loadMovie("rain.jpg", weatherholderLoader);
};
Oh thank you so much! :D
okay, thank you again. :)
But now im stuck again, I have been reading kirupas xml to flash tutorials for 4 hours now, and I understand just a bt more ;)
But how can i get my xml on to the flash stage in any way? I always get it al in the output window. and up there it seems to turn out useless.
Lets say that somewhere in the xml file we have the following text:
(pasted from my xml file)
Code:- <pointforecast>
<name>OSLO</name>
<datetime>20050929140000</datetime>
<winddirection>171</winddirection>
<windspeed>4</windspeed>
<cloudcover>70</cloudcover>
<temperature>11</temperature>
<prec06>1</prec06>
<mslp>1004</mslp>
<symbol>9</symbol>
</pointforecast>
okay... lets see.
#1
<name>OSLO</name> That`s the capital city of Norway.
#2
<datetime>20050929140000</datetime> seems to be year 2005 month 09 day 29. at 14.00.00 a clock? (wich again would be 02.00.00 pm)
Am I right about this?
#3
<winddirection>171</winddirection> direction of wind in amount of degrees.
#4
<windspeed>4</windspeed> the speed of the wind.
<cloudcover>70</cloudcover> clouds in percent?
<temperature>11</temperature> temprature in degrees
#5
<prec06>1</prec06> ??? - anyone know what theese represent?
<mslp>1004</mslp> ??? --"--
#6
<symbol>9</symbol> the symbol, representing the current weather for Oslo?
That was just me, trying to clear out things for my head. :shhh:
Let's just say that I have this line of code in frame 1, actionscript.
(the one that villain2 wrote here) (i named my xml. feed )
When I test the movie now my output says nothing.Code://XML Object
myXML = new XML()
myXML.ignoreWhite = true
//Last XML fil
myXML.load("feed.xml")
//Make a reference to current timeline
myXML.ref = this
// Parse XML and fetch
myXML.onLoad = function(success) {}
but when i makes it this way it reads the whole xml file.
Does it make any diffrence at al? Is it necessary to implent the last bit of code for the final result to work?Code://XML Object
myXML = new XML()
myXML.ignoreWhite = true
//Last XML fil
myXML.load("feed.xml")
//Make a reference to current timeline
myXML.ref = this
// Parse XML and fetch
myXML.onLoad = function(success) {}
//-----------
var my_XML = new XML ();
my_XML.onLoad = function(success){
if (success){
trace(this);
}
}
my_XML.load("feed.xml");
--------------------------------------
Part two of my post:
So i have a picture of norway in my flash file. Im putting it on the stage.
on layer 1.
- im making a symbol ( i guess i have to call my symbols 1 - 9 ) right?
So i have to find out what these numbers represent. We would sure not like to have snow in july or anything like that...
The symbols I can make on layer 2.
okay, lets say i have 9 different symbols. Am I ready to look at the file?
No. Because My symbols are currently blind.
So my other question is. what is the best way to do this?
Do I create a symbol named olso. with 10 frames? ( 1 for the N/A thingy.)
and make a "if symbol 7" goto frame 8?
------------------
I guess thats about it for today.. Feels like my head is spinning. :scared:
Is there something importaint im missing? Somthing other i should think of?
to make things clear, as my result i want just a "1framed" flash to show a map with the weather for tomorrow (or what so ever) with degrees (celsius)
and a sun and or clouds. (e.t.c)
Oh my god, If someone could help me out i would be very greatfull!
I hope i made myself clear. its hard to write in english.
Have a good day. And thank you and good luck to those who takes on this adventure, trying to explain me. :)
Yes, I said before that after "success" is where you write your parsing of xml.
You then need to establish variables for the nodes you're reading. Say that your actual content is on a childnode of a childnode of the first node:
Depending on how deep your xml goes, you will have to establish variables to mark each level of your xml. Then, you need to have text fields and/or loader boxes on your timeline to hold the information.Code:var root = myXML.firstChild;
nodes = root.childNodes;
itemnodes = nodes[0].childNodes;
for(var i=0; i<itemnodes.length; i++){
subnodes = itemnodes[i].childNodes
For instance, create a dynamic text field with the instance name "Cloudcover0".
When you parse through the xml with actionscript, you would define this node as:
Part 2 -Code:this.ref["Cloudcover"+i].text = subnodes[4].firstChild.toString();
Your provider should have a set of images that you can look at (ie. 1.jpg, 2.jpg etc.). I would look for that before you start making a library of images for weather conditions. Usually, they can go up to 45+ images, plus another for a default if no number is present or no weather condition is reported (due to error etc.).
To display the symbols based on the number, you would assign a value to a loader component on the stage.
Create a loader component and size it to the size of your images. Name the loader box "Image0". In your xml parsing, define the loader image value something like:
Code:this.ref["Image"+i].loadMovie("images/symbols/"+subnodes[8].firstChild.toString()+".jpg");
That will then display the image in your loader box depending on the value for that xml node.
*note - you will have to determine the values of the actual node level (whether they are itemnodes, subnodes etc.) and node values (ie. 2, 3, 4) on your own. This example was assuming that the xml node provided is on the third level:
Code:<xml>
<weather_nodes>
<pointforecast>
<name>OSLO</name>
<datetime>20050929140000</datetime>
<winddirection>171</winddirection>
<windspeed>4</windspeed>
<cloudcover>70</cloudcover>
<temperature>11</temperature>
<prec06>1</prec06>
<mslp>1004</mslp>
<symbol>9</symbol>
</pointforecast>
</weathernodes>
</xml>
But I get the xml file as i posted it on: 09-03-2007 09:30 AM.
Must i change it every day?
And where should i paste this code?
Thank you so much for trying to explain to me whats going on.Quote:
When you parse through the xml with actionscript, you would define this node as:
Code:this.ref["Cloudcover"+i].text = subnodes[4].firstChild.toString();
I would realy like to get this thing working, but i dont see why it have to be that complicated. I dont think that anyone have managed to make one yet.
You're going to have to gain a better understanding of actionscript otherwise I'll just be writing your code for you and not getting paid to do it :) ... keep with kirupa tutorials and look on adobe.com for xml feed tutorials.Quote:
Originally Posted by infralilla
You are supposed to be using a proxy script to read the xml from a news source. If you're simply copy and pasting the xml onto your server, it's obviously not going to update itself everyday. Read through some of the prior posts to see what you need to do there.
1. Web development is not easy, otherwise any joe could pick up a copy of Flash and call themselves a flash designer/developer (and believe me, there are many that do).Quote:
Thank you so much for trying to explain to me whats going on.
I would realy like to get this thing working, but i dont see why it have to be that complicated. I dont think that anyone have managed to make one yet.
2. I gave you one example of a weather flash tutorial that worked, my site:
http://www.webchannel24.com/index.ph...her/#/Weather/
There's also this kind of small site called Road Runner or something at www.rr.com/flash that kind of set the bar for the Flash weather feed.
They both use xml and are both not difficult but you have to have an understanding of xml and actionscript to get it to work correctly.
Yeah i know, But I want it so bad. And im learning as I do. trus me i have printed out at least 100 pages from kirupa, and im reading the flash bible. (wich is not helping me with xml at all) I have also been to pixeltolife.com for tutorials. But none are covering my needs. wich sould be in theory, easy.
1: I don`t understand what action to write in the symbols.
So that they updates from the xml file..
2: and where d i put the symbols? should i use external links?
can i link them to this place for example?
http://www2.storm.no/index.php?mapping=61
3: And this question is from where you gave me up i think..
I ment, if the xml file that i get from the weather central is like the one i posted in a perv post. What should then the code in flash be?
:scared:
This script will assign symbols to your loader component. You however must have a loader component(s) on the stage and they must have an Instance Name of "Image0", "Image1" etc. etc.Code:this.ref["Image"+i].loadMovie("images/symbols/"+subnodes[8].firstChild.toString()+".jpg");
2. You can use the external symbols in flash AS LONG AS they are .jpg or .png. If they're gif, you'll have to make your own symbols, save them as .jpg on your server and then load them from there. the code above assumes you have a folder titled "images/symbols/" where your symbols are located.
3. I did that two posts ago with all those code blocks in it. Those are the basics to understand how to use it. But you'll have to customize your own code buddy, sorry. Otherwise, I'd be doing your job for you.
With everything I've provided in this post you should be able to write actionscript that parses the xml, create text and loader components to display the information, and have a feed that gives you the info. It's a matter of putting the pieces together so it works.
My only other suggestion would be to make your own small xml file, test using it and that will go a long way to helping you understand how xml works with Flash. Then, you will be able to create these apps.
Try getting a simple xml file to display first, and then feel free to ask if you have any questions about more complex issues. But you should be able to do a simple xml read in flash from what's in this thread.
is it the same when im doing it with as 3 ?
I wonder if someone could write me the script?
I am no programmer and I have little knowlege about as 2 and 3.
So if anyone here could write me a weather xml script?
I want the weather just to show in the swf file. There is no need for input zip code.Code:<?xml version="1.0" encoding="utf-8" ?>
- <wod>
- <pointforecast>
<name>OSLO</name>
<datetime>20050929080000</datetime>
<winddirection>138</winddirection>
<windspeed>4</windspeed>
<cloudcover>75</cloudcover>
<temperature>8</temperature>
<prec06>0</prec06>
<mslp>1005</mslp>
<symbol>4</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20050929140000</datetime>
<winddirection>171</winddirection>
<windspeed>4</windspeed>
<cloudcover>70</cloudcover>
<temperature>11</temperature>
<prec06>1</prec06>
<mslp>1004</mslp>
<symbol>9</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20050929200000</datetime>
<winddirection>258</winddirection>
<windspeed>1</windspeed>
<cloudcover>92</cloudcover>
<temperature>9</temperature>
<prec06>3</prec06>
<mslp>1006</mslp>
<symbol>9</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20050930080000</datetime>
<winddirection>352</winddirection>
<windspeed>3</windspeed>
<cloudcover>30</cloudcover>
<temperature>8</temperature>
<prec06>0</prec06>
<mslp>1014</mslp>
<symbol>2</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20050930140000</datetime>
<winddirection>184</winddirection>
<windspeed>2</windspeed>
<cloudcover>79</cloudcover>
<temperature>9</temperature>
<prec06>0</prec06>
<mslp>1015</mslp>
<symbol>4</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20050930200000</datetime>
<winddirection>148</winddirection>
<windspeed>4</windspeed>
<cloudcover>98</cloudcover>
<temperature>9</temperature>
<prec06>1</prec06>
<mslp>1011</mslp>
<symbol>9</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20051001140000</datetime>
<winddirection>187</winddirection>
<windspeed>3</windspeed>
<cloudcover>99</cloudcover>
<temperature>13</temperature>
<prec06>2</prec06>
<mslp>1001</mslp>
<symbol>9</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20051002140000</datetime>
<winddirection>77</winddirection>
<windspeed>1</windspeed>
<cloudcover>6</cloudcover>
<temperature>12</temperature>
<prec06>0</prec06>
<mslp>1016</mslp>
<symbol>1</symbol>
</pointforecast>
- <pointforecast>
<name>OSLO</name>
<datetime>20051003140000</datetime>
<winddirection>213</winddirection>
<windspeed>2</windspeed>
<cloudcover>79</cloudcover>
<temperature>14</temperature>
<prec06>0</prec06>
<mslp>1018</mslp>
<symbol>4</symbol>
</pointforecast>
</wod>
What i realy need is just to get a as2 script to comunicate with the xml and showing the table with the 5 days and the current information in it.
Can anyone plz write this? I am sick of trying.
thanks
Villain,
Are you still around to help with this?
~ Brian
I'm willing to pay for this via PayPal. I need to get this up and running by Friday 9/21/07. Please help?
~ Brian
Yup, still around, what is the issue?Quote:
Originally Posted by mrshybee
Hi Villain,
I'm confused about where all the code is supposted to go? So far, I have one layer with the following code:
--------------------------------------
//Create the XML Object
myXML = new XML()
myXML.ignoreWhite = true
//Load XML file
myXML.load("http://xoap.weather.com/weather/local/30066?cc=*&dayf=2&prod=xoap&par=1035856886&key=edb 85e463dbfff25.xml")
//Make a reference to current timeline
myXML.ref = this
// Parse XML and fetch
myXML.onLoad = function(success){}
--------------------------------------
Where is everything else supposed to go - relitive to layers and images?
Hope all is well.
Let me know,
Thanks,
~ Brian
Is there anyway you could take a screenshot or something to show us how you set this up? I've been working on this all day, and i think i have all the elements, but I have no idea how to arrange them.
First, I'd strongly suggest you reference this page on kirupa:
http://www.kirupa.com/web/xml/XMLwithFlash3.htm
After function(success){ is where you write the code to pull xml nodes in to different aspects of your application (ie. loader boxes, text areas etc.)
Also, I would create a proxy script for your myXML.load function instead of the weather channel link directly. If you try to run that on a web site, it won't work because of Flash security issues.
Reference the proxy script listed in one of my earlier posts here.
Ok - I'll keep researching this. How much would you charge me just to set this up, or send me your example?
Ohit would be realy realy helpfull if you did manage to upload the whole shabang. so that we could see.. Ive been making progress, but im stuck in the proxy and xml listener part:mrt: