?
Solved

date/time comparison

Posted on 2007-03-28
2
Medium Priority
?
246 Views
Last Modified: 2008-02-01
Hello.  I have a situation in flash 8 where i need my movie to show different things based on the time of day it is.  like from 12 AM to 3:59:59 PM i need it to show some things and from 4 PM to 11:59:59 PM i need it to show other things.  Can someone provide some AS that will get something like this done?  i realize it's based off of the users system time.  i'm not really concerned about the year/month/day.  just the hours, minutes and seconds of whatever day.

thanks!
0
Comment
Question by:linuxrox
[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 2

Accepted Solution

by:
khoama earned 1000 total points
ID: 18809199
var dDate:Date =new Date();

//get the current Date
dDate.getDate();

// 0 <= hh <=23
hh=dDate.getHours();

// 0 <= mm <=60
mm=dDate.getMinutes()

// 0 <= ss <=60
ss=dDate.getSeconds();

//do smthing here the time here
0
 
LVL 3

Assisted Solution

by:ieciep
ieciep earned 1000 total points
ID: 18815181
the following code shows how you can compare time.

Hours value ranges from 0 - 23. Lemme know if you need the source file.

code info:
-----------
timeDisp is a movie clip symbol instance.

code:
------

var myDate:Date =new Date();
date=myDate.getDate();
hours=myDate.getHours();
mins=myDate.getMinutes();
secs=myDate.getSeconds();

if(hours>=6&&hours<16)//day
{
      timeDisp.gotoAndStop(1);
}
else if(hours>=16&&hours<20)//evening
{
      timeDisp.gotoAndStop(2);
}
else if(hours>=20&&hours<6)//night
{
      timeDisp.gotoAndStop(3);
}

Regards,
Riz
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

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,…
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…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
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.

719 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