Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Time controlled pictures..

  1. #1
    Join Date
    Apr 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face Time controlled pictures..

    ok here is my prob..

    I need an image to change when the time does.. there are radio program picts, so lets say the morning show is from 6 to 9 thats one graphic.. pic1
    then from 9:01 to 2 is the fire your boss one.. so that would be pic2
    then angela from 2:01 to 7pm thats pic3 and so on till it goes back to morning show..

    honestely I have no idea where to even start with the actionscript..
    All HELP needed and appreciated!!

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    No clue on the specific action script, but this is fairly easy.

    if (time < 8) { graphic = 1.jpg; }
    else if (time < 11) { graphic = 2.jpg; }
    else if (time < 18) { graphic = 3.jpg; }
    else { graphic =4.jpg; }

    Just find out the exact way you'd need to code it (just looking up functions; shouldn't be too hard), and use that idea.
    graphic is the image you're using, so not sure if that's exactly how you'd change it, but you get the idea, and time is a variable for the current time... you'd need to set that.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Apr 2007
    Location
    Phoenix, AZ
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Does the movie need to load these images when someone pulls up the page at a certain time of day? I've used PHP before to get the timestamp when a page loads, and then passed the variable to Flash using the swfobject implementation (http://blog.deconcept.com/swfobject/). I can go into more detail if you need me to (it's kind of late or I would right now).

  4. #4
    Join Date
    Apr 2007
    Location
    Phoenix, AZ
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok. Here's what I've done. This would be in a "filename.php" file on a server that supports PHP:

    Code:
    <head>
    ...
    <script type="text/javascript" src="swfobject.js"></script>
    </head>
    
    
    <html>
    <body>
    <?php
    $hour  = date('g');
    ?>
    
    <div id="flashOutput">
      <!-- This is where your flash movie gets inserted. This content will be replaced -->
    </div>
    
    <script type="text/javascript">
       var so = new SWFObject("myswf.swf", "output", "550", "200", "8", "#ffffff");
       so.addVariable("time", "<?php echo($hour)?>");
       so.write("flashOutput");
    </script>
    
    ...
    </body>
    </html>
    The swfobject stuff is what I use to include my swf movies. It works well, so I've included it. This code assumes that the swfobject.js file is in your directory.

    The php code to get the hour of the day is in blue. It's passed (by the javascript) to the swf using the Flashvars object, which is used to pass variables from web pages to Flash movies. The variable "hour" will be avalable on frame 1 of your movie, even though you've never declared it there. Then you can use that variable to find and load the correct image, as djr33 noted above.

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Shouldn't there also be some fallback in case javascript is disabled in the browser?
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Apr 2007
    Location
    Phoenix, AZ
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The fallback is whatever you place inside the <div> that you've specified for replacement. It holds the alternate content, and only gets replaced if javascript is enabled and the flash plugin is there. It makes for nice, silent failure of the flash content, especially if you've got a decent alternative in that div.

  7. #7
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Quote Originally Posted by djr33 View Post
    Shouldn't there also be some fallback in case javascript is disabled in the browser?
    I agree... add this code below
    Code:
    <noscript>
    <p>You have disabled Javascript, which is required on this website to function optimally. Please check your settings and enable Javascript then reload(refresh) your browser</p>
    </noscript>

  8. #8
    Join Date
    Apr 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by nwalton View Post
    Does the movie need to load these images when someone pulls up the page at a certain time of day? I've used PHP before to get the timestamp when a page loads, and then passed the variable to Flash using the swfobject implementation (http://blog.deconcept.com/swfobject/). I can go into more detail if you need me to (it's kind of late or I would right now).
    yes it would need to download the image depending on what time of day is..
    the actual site is www.heymix.com

  9. #9
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    The javascript is just seeding the time, so I meant that there should be a default image if there were no time supplied to the Actionscript, not that there needs to be a "javascript disabled" warning.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  10. #10
    Join Date
    Apr 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok am a little confused.. hehe..
    I put Actionscript in the flash file (my swf) on the timeline.. with the IF and ELSE statements..

    then on my html file I write: under the <div> tag
    <noscript>
    <p>You have disabled Javascript, which is required on this website to function optimally. Please check your settings and enable Javascript then reload(refresh) your browser</p>
    </noscript>

    Also need to make sure I have the "swfobject.js" on the same folder as my html and the "filename.php" on the php server..

    Ok, I know it might seem dumb, but I dont have much experience with AS or programing (none).. a friend of mine did the php on that site.. I am more thatn willing to learn thou..

    Thanks so much for helping me.. and please bear with me

Bookmarks

Posting Permissions

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