PDA

View Full Version : Flash weather baby!


cardiac7
07-25-2003, 04:49 PM
Alright .... I KNOW this has to be possible somehow!

I want to pass the current temperature to a flash movie based on a zipcode location that I will have on a .asp page, which will be passed to the Flash movie. So in flash I will have a var like "var currentTemp = temp" where temp is the variable passed into flash.

Does anyone know where I can find a resource for some guidance as to the .asp scripting or anything like that?

I have seen a php version, but unfortunately I need to use .asp. :(

Thanks to you!

freddycodes
07-25-2003, 05:15 PM
A couple of questions? Is this straight ASP or ASP.NET? Did you want to be able to pass the zip code from flash to ASP or will the zip code be hard-coded in the ASP script?

freddycodes
07-25-2003, 07:06 PM
Okay so I was interested in how to do this, so I wrote up an example. The ASP script and .fla are in the zip.

cardiac7
07-28-2003, 11:29 AM
freddy...

Thank you sooo much for those files....exactly what I had in mind....with a couple minor exceptions.

First, you have that data being returned "onPress" right? Well I would like it to happen without having to do that, so is it possible for me to use an "onLoad" and have the same effect?

I am using straight .asp with the ZIPCODE being passed into Flash in the EMBED and OBJECT tags, so onLoad it should be in there right?!

And I don't need quite that much weather data either, so what is the best way to strip off tags that I don't need? The only 2 I really would like to use are the temperature in F and the current conditions.

Thanks alot FreddyCodes!

freddycodes
07-28-2003, 12:03 PM
What I gave you was base code to show you how to interact with the WebService. You can do anything you want with it. Since I am feelin extra generous I decided I would go ahead and show you how to do what you wanted.

cardiac7
07-28-2003, 12:13 PM
Oh My God!! You have to be the nicest guy in the world!!:D

That is so nice of you, it says alot for your character to take time out of your life to help me like that.....BIG thanks!

I was in the process of tearing the other apart and .... :o ...I gotta say that I wan't all that close to what you have!

But thanks again and I'll let ya know how it goes!

:cool:

cardiac7
07-28-2003, 12:42 PM
sweet its ALOMOST working...jsut one quick question.

I am trying to get it to display all on one line...such as:

Fahrenheit 67F and Partly Sunny

But all I can get to display is the Fahrenheit 67F? I removed the "/n" that you had in there and replaced it with " ". Do I need to concantenate it or what?

And in your line:

if(tmp[i].nodeName == "Fahrenheit" || tmp[i].nodeName == "Condition") {


...do I make the || into a && ?????? ...Nevermind about that... I see its a for loop.

Rock!

freddycodes
07-28-2003, 12:54 PM
You'll definitely want t || and not the && since the nodename can never equal both at the same time. Also, you just need to change it around a little to make it show on one line, instead of appending the line to the text field on each iteration of the loop, you would just wait until the end.


System.useCodePage = true
if(ZipCode == undefined) ZipCode = 93001;
myXML = new XML();
myXML.ignoreWhite = true;
myXML.load("http://freddyserver:8100/GetWeather/GetWeather.asp?ZipCode="+ZipCode+"&ck="+getTimer());
myXML.onLoad = function(s) {
_root.txt_status.htmlText = "";
var tmp = this.firstChild.childNodes;
var el = "";
for(var i=0;i<tmp.length;i++) {
if(tmp[i].nodeName == "Fahrenheit" || tmp[i].nodeName == "Condition") {
el += "<b>" + tmp[i].nodeName + ": </b>"
el += tmp[i].firstChild.nodeValue + " ";
}
else continue;
}
_root.txt_status.htmlText = el;
}
stop();

cardiac7
07-28-2003, 12:59 PM
Jesus...you're great! Thanks a ton... it works like a charm and yet at the same time looks simply marvelous! :p

Thanks for the quick replies and great assistance!

Great site BTW!

tim_ver
08-13-2005, 12:54 AM
Hey I d/led this and looks great but I am on a linux server and need mysql, asp won't work anyone please help?

Thanks

Much

jstauff
07-03-2006, 10:03 PM
Is it possible to use the abovementioned script to connect to a remote WSDL using Flash 8?

I also have a limited knowledge of reading a WSDL through webservicesconnector. I am fairly certain my script is correct though it comes back 'undefined'. The particular webservice is up and running remotely.

Anyone with any incite or a URL that can give me some input?

djbobo21
01-14-2008, 03:25 PM
Look this weather.
http://www.flashcomponents.net/upload/samples/265/index.html?full=true
http://www.flashcomponents.net/component/flash_igoogle_weather.html
Is there better sollution? I need something like that... :(