A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Weather project

  1. #1
    Member
    Join Date
    Mar 2003
    Location
    Netherland
    Posts
    33

    Weather project

    Hello,
    i try to make a nice online weather report for my weatherstation min, max, and normall temperature, just like the picture below.
    So what i like to do is, add a value for the normall temperature for this day (let's say 4,5c) this is value that will not change till the next day, and in the color box the current temperature, so when the ActionScript is get a value from my station, the color is going up or down. (update every 5 min)
    I think this is posable in KoolMoves, but don't know where to start.
    Hope some one can help me.
    Thank you.
    Gr Hans
    Attached Images Attached Images
    Last edited by hansverst; 12-20-2006 at 09:37 AM.

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    If the data is retrievable I'm sure it can be done in KM.

    What format is the data in? How are you getting the data.

  3. #3
    Member
    Join Date
    Mar 2003
    Location
    Netherland
    Posts
    33
    Hi Blanius,
    the data is text/plain the values are true values, like 10,1 for 10,1 celecius
    and for rain, 0,7mm etc
    So i use special weather software (that updates the weather station and get the current data) and that software make a text file report.ws from all data like wind, rain, sun, temp, etc.
    Gr Hans

    This is how it looks.

    --------------------- sorry in dutch only

    Weergegevens - Report: 2 m boven zeeniveau
    woensdag 20 december 2006 - 16:27

    Temperatuur Buiten 1.25cm
    huidig 4,2 °C
    Gemiddelde 0,7 °C
    min. -1,8 °C 03:47
    max. 4,2 °C 16:07

    Temperatuur Buiten 0.20cm
    huidig 4,4 °C
    Gemiddelde 1,1 °C
    min. -1,4 °C 03:42
    max. 4,4 °C 16:27

    UV X
    huidig 0,0 UV-I
    Gemiddelde 0,0 UV-I
    min. 0,0 UV-I 23:12
    max. 0,3 UV-I 11:02

    Vochtigheid Buiten
    huidig 95 %
    Gemiddelde 93 %
    min. 91 % 23:12
    max. 95 % 11:42

    Windsnelheid
    huidig 2,9 km/h
    Gemiddelde 0,2 km/h
    max. 3,5 km/h - W-ZW 16:17

    Neerslag
    laatste uur 0,0 mm
    huidige dag 0,0 mm
    laatste 24 uur 0,0 mm
    huidige week 0,0 mm
    huidige maand 0,7 mm
    huidig jaar 0,7 mm
    Regen / Jaar 1 dagen

    Luchtdruk
    huidig 1038,8 hPa
    Gemiddelde 1038,1 hPa
    min. 1036,3 hPa 13:12
    max. 1039,2 hPa 10:52

    Weersvoorspelling: zonnig

    --------

    i think to get the data is not that hard, but to change the graphics if the value is change.
    I think there have to be a min and a max default value. For rain it would be like 0,0 mm for min and max like 20 mm (that would be 100%) and if the data shows 1,7mm the graphic must go up from 0% to X%
    Last edited by hansverst; 12-20-2006 at 11:42 AM.

  4. #4
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    those commas are a problem..... Flash doesn't see 1,2 as a number..... So you'll have to deal with that..

    Ok here's a start
    Attached Files Attached Files

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Basically I used onData then replaced all the , with . and then serached looking for min. and max. then grab the temp after those and scaled a movieclip using the tempurature

  6. #6
    Member
    Join Date
    Mar 2003
    Location
    Netherland
    Posts
    33
    Well this look nice, i think i can with your code make a good working weather control for my webpage.
    I will let it know if it's done, or not
    Thanks for all the help!
    Gr Hans

  7. #7
    Member
    Join Date
    Mar 2003
    Location
    Netherland
    Posts
    33

    updates

    hi blanius,
    i did make a good working temp meter. (thanks again for that)
    But only one question, now i want to update the data every time a vistor is loading the temp meter.

    I try the next code but is still not working proper.

    'int' is the time in sec for a new update equally to the real update from the weatherstation.
    After that the fun file have to update data every 5 min (equally to the real update from the weatherstation.)
    The first time the fun file is loaded, it have to update directly, so the last update from the weatherstation is showing


    weatherdat= function (){

    _root.loadVariables("http://82.134.247.103/cgi-bin/weer/get.pl", "POST");

    temp = searchandreplace(temp,",",".");
    p=((Number(temp)+0)/maxTemp)*100
    tmpbar._yscale=p
    txt1.text=temp+"°C";

    setInterval(weatherdat, int);
    }
    weatherdat(int=1000);


    I know i ask a lot, but realy try to learn
    Gr, Hans
    Attached Images Attached Images

  8. #8
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    don't think thats the right way to use set interval

    try this
    weatherdat= function (){

    _root.loadVariables("http://82.134.247.103/cgi-bin/weer/get.pl", "POST");

    temp = searchandreplace(temp,",",".");
    p=((Number(temp)+0)/maxTemp)*100
    tmpbar._yscale=p
    txt1.text=temp+"°C";

    }
    int=1000

    setInterval(weatherdat, int);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center