Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a flash move 4 times a day....PLEASE READ!

Status
Not open for further replies.

charlesjsc

Programmer
Sep 14, 2007
15
US
Hi,
Boy, have I got one for ya.
I want to run a FLASH movie which I already have set up. NOW what I want to do is write javascript function to make that move run at 8am, and maybe last 3 minutes, then display a quote on the screen, then run again at 11 am, then at 2pm, then at 5 pm. (corporate :-(.)
Thing is, I am kinda a newbie at JS and don't know how to code it. Looks GREAT on paper! :)

Any suggestions anyone? I know you JS programmers out there have a coding solution!!
 
Personally, I'd only use JS to show the movie at those times. I would not use JS to make the movie "last 3 minutes" - surely that would be something you would build into the Flash movie itself?

Anyway... to get the current time and compare it to a certain hour (e.g. 11am) you can use:

Code:
var timeNow = new Date();
if (timeNow.getHours() == 11 && timeNow.getMinutes() == 0 && timeNow.getSeconds() == 0) {
   // do something here
}

There will be many ways to make a Flash movie play. Personally, I'd investigate the JavaScript Flash Gateway (Google is your friend). This will let you communicate easily between Flash & JS, so you can tell the movie to start, and call back when it has finished.

To hide & show elements, for example, a DIV element with an ID of "wibble", you can use:

Code:
document.getElementById('wibble').style.display = 'none';

and

Code:
document.getElementById('wibble').style.display = 'block';

respectively.

That should give you a good starting point to work from!

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
As an added note, if you need to worry about different timezones or you need to prevent users from seeing the movie ahead of time (because they could just change the clock on their computer), then I would handle this using a server-side technology such as ASP.NET or PHP instead of using JavaScript.

Adam
 
charlesjsc,

Given your new post, I'm guessing this was helpful. However, it's normal to give some feedback on a post, rather than just leaving it hanging and starting a new one.

Perhaps you could do so?

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top