Different Times, Different Clip

  • JStell
  • Newbie
  • Newbie
  • JStell
  • Posts: 5

Post 3+ Months Ago

Is it possible to have a Flash clip running from 8am-6pm and then different one from 6pm-8am? I do not need this be online so it doesnt have to be done in HTML but it would be preferable.

Thanks!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • JStell
  • Newbie
  • Newbie
  • JStell
  • Posts: 5

Post 3+ Months Ago

Is it possible to have a clip running from 8am-6pm and then different one from 6pm-8am? I dont mind if it is done in the actualy Flash or with two seperate files in HTML.

Thanks!
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

Well to answer your question you can do it either way. Flash, Javascript and I'm sure PHP/ASP/Etc can all tell time. In flash I would make one container clip that always exits and have it load a different clip at the correct times.

The basic concept is like this:
Code: [ Select ]
time = new Date();
// time object
var hours = time.getHours(); // returns a number between 0 and 23
this.createEmptyMovieClip("loadContainer", this.getNextHighestDepth());
if(hours > 9 && hours < 14){
    loadMovie("cliptoload.swf",loadContainer);
}else{
    loadMovie("othercliptoload.swf",loadContainer);
}

// if hour falls between 9 and 14 load movie A
// if hour is anything outside that range load movie B
  1. time = new Date();
  2. // time object
  3. var hours = time.getHours(); // returns a number between 0 and 23
  4. this.createEmptyMovieClip("loadContainer", this.getNextHighestDepth());
  5. if(hours > 9 && hours < 14){
  6.     loadMovie("cliptoload.swf",loadContainer);
  7. }else{
  8.     loadMovie("othercliptoload.swf",loadContainer);
  9. }
  10. // if hour falls between 9 and 14 load movie A
  11. // if hour is anything outside that range load movie B


You can refine all that to find out how many minutes away something is, etc but thats the basic premise
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

Hi, there is obviously many ways to go about it. But the 2 better ways I can think of doing this are either by programming it into the action script of the flash (which I wouldn't do) or using a Server Side Language like PHP. Check out this thread for more information:

http://www.ozzu.com/programming-forum/website-working-hours-t70061.html
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

yea, that would be the basic concept.
place that in an onEnterFrame and then check if the movie is already loaded, so that you won't load it 32424324 times.
something like:
Code: [ Select ]
this.createEmptyMovieClip("loadContainer", this.getNextHighestDepth());
var isFirstLoaded = false;
var isSecondLoaded = false;

onEnterFrame = function()
{
time = new Date(); // time object
var hours = time.getHours(); // returns a number between 0 and 23

if(hours > 9 && hours < 14)
{
  if (!isFirstLoaded)
 {
   loadContainer.loadMovie("cliptoload.swf");
   isFirstLoaded = true;
   isSecondLoaded = false;
 }
}
else
{
  if (!isSecondLoaded)
  {
   loadContainer.loadMovie("othercliptoload.swf");
   isFirstLoaded = false;
   isSecondLoaded = true
  }
}
}
stop();
  1. this.createEmptyMovieClip("loadContainer", this.getNextHighestDepth());
  2. var isFirstLoaded = false;
  3. var isSecondLoaded = false;
  4. onEnterFrame = function()
  5. {
  6. time = new Date(); // time object
  7. var hours = time.getHours(); // returns a number between 0 and 23
  8. if(hours > 9 && hours < 14)
  9. {
  10.   if (!isFirstLoaded)
  11.  {
  12.    loadContainer.loadMovie("cliptoload.swf");
  13.    isFirstLoaded = true;
  14.    isSecondLoaded = false;
  15.  }
  16. }
  17. else
  18. {
  19.   if (!isSecondLoaded)
  20.   {
  21.    loadContainer.loadMovie("othercliptoload.swf");
  22.    isFirstLoaded = false;
  23.    isSecondLoaded = true
  24.   }
  25. }
  26. }
  27. stop();
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Please don't start multiple topics on exactly the same subject in different forums. It gets confusing for people to follow.
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

I'm sure he didn't know before I posted the old topic, I had to research for it again, it was a couple weeks old.

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 9 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.