Solved

actionscript - detect server time and display relevant imagery

Posted on 2006-07-10
2
175 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
2 Comments
 
LVL 7

Accepted Solution

by:
muxxter earned 500 total points
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
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.

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now