?
Solved

actionscript - detect server time and display relevant imagery

Posted on 2006-07-10
2
Medium Priority
?
218 Views
Last Modified: 2008-03-10
Hi,

I'm working on a flash movie whose background image should change according to the time of day:

7am - 5pm - day time
5pm - 8pm - cloudy
8pm - 7am - evening

This is the actionscript function I have so far:

function getGTM(){
        // Create the date object and obtain the universal hour
        var tDate:Date = new Date();
        tH = tDate.getUTCHours();
       
        // Compare the hour and determine the image to display
        if((tH >= 7) && (tH <= 17)){
                cielo.gotoAndStop("day");
                luces.gotoAndStop(1);
                pMostrar = "Day";
        }else if((tH >= 17) && (tH <= 20)){
                cielo.gotoAndStop("afternoon");
                luces.gotoAndStop(1);
                pMostrar = "Afternoon";
        }else{
                cielo.gotoAndStop("evening");
                luces.gotoAndStop(2);
                pMostrar = "Evening";
        }
}
getGTM();


It's not working as planned. I'd greatly appreciate any insight.

Thanks,

Al
0
Comment
Question by:myrepublic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
muxxter earned 1500 total points
ID: 17111264
Well first, I would fix the redundancy when comparing the hour to 17. More than one case is true when it's 5 o'clock. Unless that's what you want. :-)

Other than that, it looks sound. What does it not do that you'd like to have it do?

MuXx
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question