Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 08-23-2012, 12:28 PM   #1
Deniss
Registered User
 
Join Date: Aug 2012
Posts: 1
Default Can you play particular scenes at different times in Flash?

I really don't know how to tell what I'm asking but I'll try with an example
Say, I have 5 different scenes and there is a different image in each one.
Is there an ActionScript code to let these scenes play at different times of the day?
For example:
Scene 1 - From 0:00 to 5:59 AM
Scene 2 - From 6:00 to 11:59 AM
Scene 3 - From 12 to 17:59 PM
And so on. Is there an automatic way to do it or do you have to alter the Flash document all the time?
Thank you.
Deniss is offline   Reply With Quote
Old 08-23-2012, 03:23 PM   #2
CaptRadioVoice
ˇCapitán Voz de la Rádio!
 
Join Date: Dec 2011
Location: Cincinnati, OH, USA
Posts: 14
Default

Try this on your root:

Code:
stop();

_root.onLoad = function() {
    var timeNow = new Date();
    hours = timeNow.getHours();
    if (hours >= 0 && hours < 6) {
        gotoAndPlay('Scene 2', 1)
    } else if (hours >= 6 && hours < 12) {
        gotoAndPlay('Scene 3', 1)
    } else if (hours >= 12 && hours < 18) {
        gotoAndPlay('Scene 4', 1)
    } else if (hours >= 18 && hours < 24) {
        gotoAndPlay('Scene 5', 1)
    }
}
Change the scene names to match yours, of course.

EDIT: And I suppose change the hours to suit your needs too. I assumed 4 different times, but I see you have 5 scenes.

Last edited by CaptRadioVoice; 08-23-2012 at 03:25 PM.
CaptRadioVoice is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:34 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.