A Flash Developer Resource Site

Page 1 of 3 123 LastLast
Results 1 to 20 of 56

Thread: Real-Time* based animations

  1. #1
    Youbackalyte
    Join Date
    Apr 2006
    Location
    Rome
    Posts
    75

    Real-Time* based animations

    Hey, I am using Flash MX Proffessional 2004 and was wondering if anyone can point me to a tutorial on creating a movie clip that changes apparent to the time set on the computer viewing it, just needing this for a more interactive website. Thanks. I thought I had seen this done before.
    Last edited by FatherBrandon; 04-04-2006 at 11:33 PM.

  2. #2
    All 1s and 0s dmonkey's Avatar
    Join Date
    Nov 2005
    Location
    Leeds, UK
    Posts
    606
    Hi,

    Take a look at the Date() class in flash reference. It will give you information about the current time as set by the computer's clock. You can use this to get the hours, minutes, seconds etc. and make your clip respond accordingly.

    Search for any tutorial using the Date() class.
    "If I have seen further, it is by standing on the shoulders of giants." - Sir Isaac Newton

  3. #3
    Youbackalyte
    Join Date
    Apr 2006
    Location
    Rome
    Posts
    75
    Thanks a lot mate! I appreciate it.

  4. #4
    Youbackalyte
    Join Date
    Apr 2006
    Location
    Rome
    Posts
    75
    I hate to ask more, but I can not locate any tutorials using the "Date()" class, do you have a specific link? (I tried searching this forum and google of course). Thanks.

    P.S. I probably should have posted this in the beginner section as I do not have a strong grasp of how to script, if any moderator can move it that would be awesome.
    Last edited by FatherBrandon; 04-02-2006 at 07:16 AM.

  5. #5
    Youbackalyte
    Join Date
    Apr 2006
    Location
    Rome
    Posts
    75
    What I am basically hoping to do is set a clock, and every half and hour a new movie clip plays, at the start of the new time (lets say "8:30" pm to 9:00 pm) it gets rid of the old animation and starts playing the new one set for that time.

  6. #6
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    Are you using loadMovie to load external .swf files based on time or just trying to tell embedded movieclips to play based on time?

  7. #7
    Youbackalyte
    Join Date
    Apr 2006
    Location
    Rome
    Posts
    75
    Embedded I think, one .swf that contains all of the set movie clips. Although I would like to be able to do both embedded and a loadmovie. But the embedded is really what I am looking for right now. My entire website basically will revolve around this feature as I am mainly a graphic artist/Musician and wanted to setup something like this for a long time. Basic idea is a world map, small house areas and forests, you can visit each from the website and depending on what time it is different events are occurring.

  8. #8
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Removing any helpful previous posts I mistakenly contributed to these forums.

    See ya FK'ers
    Last edited by NTD; 10-19-2006 at 07:31 AM.

  9. #9
    Youbackalyte
    Join Date
    Apr 2006
    Location
    Rome
    Posts
    75
    Thanks tons dude, I am still a bit confused though, in the first two examples, what variables would I set for a specific time to call the clip to play (Example: hour 13 of a 24 hour clock)? In the first example could you make up a random time and link it to a fictional movie clip, just for example purposes so I could replace it for a quick test? Also, what is the "(hour+1)" for? I think once I fully understand how the first example works I will get this more.

  10. #10
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Removing any helpful previous posts I mistakenly contributed to these forums.

    See ya FK'ers
    Last edited by NTD; 10-19-2006 at 07:31 AM.

  11. #11
    Youbackalyte
    Join Date
    Apr 2006
    Location
    Rome
    Posts
    75
    Thanks again, I tried experimenting with the first bit of code, but can only get it to output the correct time. The movie clip just loops continuously and outputs the time after each loop. I have attached the experiment clip to this reply. You have helped so much already, thanks!
    Attached Files Attached Files

  12. #12
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Removing any helpful previous posts I mistakenly contributed to these forums.

    See ya FK'ers
    Last edited by NTD; 10-19-2006 at 07:31 AM.

  13. #13
    Youbackalyte
    Join Date
    Apr 2006
    Location
    Rome
    Posts
    75
    I have added "stop();" to the beginning of the the following code, it didn't work. I also tried adding it to the end after the "}", I have also tried adding it to the ending inside the "{". I tried making a new a layer and applying the "stop();" to the first frame of it, nothing seems to make it work:

    now = new Date();

    hour = now.getHours();

    trace(hour);

    _root.backGround.onEnterFrame = function() {

    this.gotoAndStop(hour+1);

    }

    Where should I add the "stop();"? Thanks again dude. If you need anymore information please ask me.

  14. #14
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Removing any helpful previous posts I mistakenly contributed to these forums.

    See ya FK'ers
    Last edited by NTD; 10-19-2006 at 07:32 AM.

  15. #15
    Youbackalyte
    Join Date
    Apr 2006
    Location
    Rome
    Posts
    75
    Unfortunately I can not open that file. I am using Flash MX Proffessional 2004, I did double check the instance name of my movie clip, it does match, here is what I have done on the first frame of the movie clip:


    stop();
    now = new Date();

    hour = now.getHours();

    trace(hour);

    _root.backGround.onEnterFrame = function() {

    this.gotoAndStop(hour+1);

    }

    Have also tried it here:

    now = new Date();

    hour = now.getHours();

    trace(hour);

    _root.backGround.onEnterFrame = function() {

    this.gotoAndStop(hour+1);

    stop();
    }

    And here:

    now = new Date();

    hour = now.getHours();

    trace(hour);

    _root.backGround.onEnterFrame = function() {

    this.gotoAndStop(hour+1);

    }
    stop();

    Thanks again dude.

  16. #16
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Removing any helpful previous posts I mistakenly contributed to these forums.

    See ya FK'ers
    Last edited by NTD; 10-19-2006 at 07:32 AM.

  17. #17
    Youbackalyte
    Join Date
    Apr 2006
    Location
    Rome
    Posts
    75
    Its now calling upon the correct time and stopping, but it is still not going to the correct frame of the movie clip. I have attached the new test.

    In my main timeline I have "Layer 1", I have the bulk of the code as you have suggested on the first frame (there is only one frame made on this layer). Then, still on Layer 1 (in the first frame) I create a movie clip with the instance of "Background". Inside of that movie clip I creat a motion tween that gradually turns the brightness of the movieclip down to -100% from a keyframe on the first frame to a keyframe on the 24th frame (I have placed the "stop()" code in the first frame of the tween inside the movieclip). I really appreciate all that you are doing.
    Attached Files Attached Files

  18. #18
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Removing any helpful previous posts I mistakenly contributed to these forums.

    See ya FK'ers
    Last edited by NTD; 10-19-2006 at 07:32 AM.

  19. #19
    Youbackalyte
    Join Date
    Apr 2006
    Location
    Rome
    Posts
    75
    I thank you heartily for helping me through this. It is now functioning.

  20. #20
    Youbackalyte
    Join Date
    Apr 2006
    Location
    Rome
    Posts
    75
    Sorry to be back but I have tested this code further and it seems that it does not update when the hour changes, you have to shut it down and re-open the movie in order for it to update along with the time set on your computer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center