Saturday, April 09, 2005

Should I take a jacket?

There is a saying in DC that goes something like this:

"If you don't like the weather here, hold on a minute..."

If I'm on site on a project, I find that I sometimes don't have a good view of a window to keep an eye on weather conditions. "Okay, Mike, while you're here, you can use this broom clos... eh..office to work in. Mind the bucket."

Not knowing the current weather can sometimes be a bad thing.

You've done it before. You find yourself coding for eight solid hours with your eyes glued to the screen and the headphones on when you finally look up. Everyone has gone home including the cleaning crew, and there are six inches of partly cloudy covering the roads for your ride home. You only worked late because you didnt' want to break your rhythm.

I'm afraid the weather bug might take out a credit card in my name and since I have so much free time on my hands, I thought I would do something to help my problem.

Like any normal developer, I decided to slap toghether something just to see if I could do it.

Well this one was almost trivial. Just using the built in components and the NOAA xml service, I was able to put together the weather box you should be seeing to the left.

No server-side technology is used, which means you can run it just about anywhere.

Feel free to grab the swf if you want. Use the code below to embed the flash file in your page. You want to edit the four locations I highlighted to point to the location of your copy of the swf file and the call letters of your local NOAA weather station. If you're interested in .fla, just send me a note and you're free to hack. Just show me any mods you make to the .fla.


<!-- Weather panel -->

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="200" height="300" id="weather" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="Web address of swf file" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="FlashVars" value="NOAAStation=KBWI" />
<embed FlashVars="NOAAStation=KBWI" src="Web address of swf file" quality="high" bgcolor="#ffffff" width="200" height="300" name="weather" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<!-- end Weather panel -->

1 comment:

  1. Can I get a copy of the .fla you used for the weather on your April 9, 2005 posting?

    E-mail is cthew@communitynet.org. Please don't post the e-mail.

    ReplyDelete