Solved

actionscript - detect server time and display relevant imagery

Posted on 2006-07-10
2
216 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 500 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

696 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