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

Thread: Image Changing With Time - On air Now

  1. #1
    Join Date
    Oct 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Image Changing With Time - On air Now

    Hi im looking for a simple code or flash file that includes either an or air now text wich changes with time or an image that changed with time.

    please help me im sick of trawling the net

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Depends, do you want this automatically for a certain time each day, each week, every 6 hours, etc or do you want it done manually? (will change when user logs in?)

    If the first option you will need to get the local time:

    Code:
    function getTime () {
     var time = new Date();
     var hour = time.getHours();
     var minute = time.getMinutes();
     var second = time.getSeconds();
     var temp = ""+((hour>12) ? hour-12 : hour);
     temp += ((minute<10) ? ":0" : ":")+minute;
     temp += ((second<10) ? ":0" : ":")+second;
     temp += (hour>=12) ? " P.M." : " A.M.";
     return temp;
    }
    This will return the local time. Then you need to call it...

    Code:
    onClipEvent (enterFrame) {
     time = getTime();
    }
    This code placed on the first frame of a dynamic text movieClip and will get the current local time.

    Then use your Dynamic Text box for the On/Off air coded based on time.

    Code:
    onClipEvent (enterFrame) {
    	time = getTime();
    	if (hour==6) {
    		time = getTime()+"On The Air";
    	} else {
    		time = getTime()+"Off The Air";
    	}
    }
    this place on the first frame of the movie will display the time and either on or off the air.

    You can adjust the if/else to suit the hour(s) On the air should be displayed, etc.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Oct 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok i need it to change between every hour of the day 7 days a week thats it.

    i have seen other code but a bit unsure,

    either images or text.

    cheers

  4. #4
    Join Date
    Oct 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i know its not that simple but i need something like,

    if day = (1)/monday and if time = 12am get img src "http://image.gif"
    if day = (1)/monday and if time = 01am get img src "http://image2.gif"

    and so on untill every day and hour is covered

    i wish it was that simple but very difficult unless you know what you are doing. i bought a book on java and it is just plain java jaba jaba. lol

    help before i go mentle lol

    regards lee

  5. #5
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Well, this is the Flash forum, not the Java forum, so which do you need? They are not the same thing...

    Basically you want 168 different images to show? (24 hours a day, 7 days - 24*7=168)

    If they are names image.jpg, image1.jpg, image2.jpg it will make it easier.

    I want to make sure you want to use Flash before I get into it though...
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

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

    Default

    This doesnt sound like flash is necessary? you could very easily use Javascript which would provide alot better access.
    also if there is a new person on every hour every day... if not you should edit the script, because theres no sense in reloading the element if the same image will be displayed

  7. #7
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Very rarely is Flash "necessary" but it sure is fun
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  8. #8
    Join Date
    Oct 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hi there

    i really dont mind flash would be good and java would be could i would happilly have flash i just need the coding

    cheers

  9. #9
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Probably the easy way would be this:

    make a new symbol, a movie clip name it clock. In the MC make a dynamic text box with the var: time. In the first frame of clock MC put this code:

    Code:
    function getTime () {
     var time = new Date();
     var hour = time.getHours();
     var minute = time.getMinutes();
     var second = time.getSeconds();
     var temp = ""+((hour>12) ? hour-12 : hour);
     temp += ((minute<10) ? ":0" : ":")+minute;
     temp += ((second<10) ? ":0" : ":")+second;
     temp += (hour>=12) ? " P.M." : " A.M.";
     return temp;
    }
    Now, drag an instance of clock MC to the stage. In the first frame of the stage place this action script:

    Code:
    onClipEvent (enterFrame) {
    	time = getTime();
    	if (hour==12) {
    		loadMovie("image1.jpg", _root.holder);
    	} 
            else if (hour==11){
                    loadMovie("image2.jpg", _root.holder);
            }
            //continue else if's for the rest of the hours.
    }
    This will make a real time clock in the clock MC. It will also load the jpg into a blank MC named "holder", which we need to create:

    click insert>>new symbol name it holder. You will currently be in edit mode of holder MC. click "scene 1" to exit out of edit mode.

    Drag an instance of holder from the library to the stage where you want the image to appear. Give holder MC an instance name of holder. in the library right click the holder MC and click "linkage" then check the box next to "export for actionscript" leave everything else as it appears and click okay.

    test movie. (note the images must be in the same directory as the swf for them to load).

    Enjoy
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  10. #10
    Join Date
    Oct 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    is there anyway you can make me a demo?

    and send it to my email.

    info@lee-mills.co.uk

    if possible dont worry if you cant i will have to practise.

    regards lee

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
  •