swf clocks + javascript

Discussion in 'JavaScript' started by delta3, Jul 17, 2010.

  1. #1
    Hi,

    I would like to have the same running clocks as on page: http://marketindex.rbs.com/uk/Home.aspx

    I looked what is the source code of that page by downloading the page and to show swf object it is:

    
    <OBJECT type="application/x-shockwave-flash" data="http://marketindex.rbs.com/media/swf/clocks.swf" width="237" height="80" id="homeclocks" style="visibility: visible; ">
    <PARAM name="wmode" value="transparent">
    <PARAM name="flashvars" value="city1=Tokyo&amp;city2=Frankfurt&amp;city3=London&amp;city4=New York&amp;ampm1=PM&amp;ampm2=PM&amp;ampm3=PM&amp;ampm4=AM&amp;hours1=22&amp;hours2=15&amp;hours3=14&amp;hours4=9&amp;minutes1=54&amp;minutes2=54&amp;minutes3=54&amp;minutes4=54"></OBJECT>
    PHP:
    When i put this code on my webpage with proper swf link on my hosting i can display these clocks but they are not running.
    (i can only see swf file in Google Chrome and Firefox, it does not show in Explorer, why?)


    I think to have these clocks running i also have to use javascript. In that source code i see it has

    <SCRIPT language="javascript" src="./Homepage_files/Website.Lib.js" type="text/javascript"></SCRIPT>
    PHP:
    and it uses 'function Clock' from that file.
    Below swf object there is another javascript:

    
    <SCRIPT language="javascript" type="text/javascript">
    var clock;
    $(function() {
     clock = new Clock(17,38);
     clock.cities[0] = ["Tokyo",7]; 
     clock.cities[1] = ["Frankfurt",0]; 
     clock.cities[2] = ["London",-1]; 
     clock.cities[3] = ["New York",-6]; 
     clock.Tick();
    });
    </SCRIPT>
    
    PHP:
    So i put all lines to my php file: http://www.emy.pl/clocks.php to try if it is running. My code is:

    
    <html> 
    <head> 
    <script language="javascript" src="http://www.emy.pl/Website.Lib.js" type="text/javascript"></script> 
    </head> 
    
    <body> 
    <object style="visibility: visible;" id="homeclocks" data="clocks.swf" type="application/x-shockwave-flash" height="80" width="237"> 
    <param value="transparent" name="wmode"> 
    <param name="movie" value="clocks.swf"> 
    <PARAM name="flashvars" value="city1=Tokyo&amp;city2=Frankfurt&amp;city3=London&amp;city4=New York&amp;ampm1=PM&amp;ampm2=PM&amp;ampm3=PM&amp;ampm4=AM&amp;hours1=23&amp;hours2=16&amp;hours3=15&amp;hours4=10&amp;minutes1=37&amp;minutes2=37&amp;minutes3=37&amp;minutes4=37"> 
    </object> 
    
    <script language="javascript" type="text/javascript"> 
    var clock; 
    $(function() { 
       clock = new Clock(17,38); 
       clock.cities[0] = ["Tokyo",7]; 
       clock.cities[1] = ["Frankfurt",0]; 
       clock.cities[2] = ["London",-1]; 
       clock.cities[3] = ["New York",-6]; 
       clock.Tick(); 
    }); 
    </script> 
    
     </body> 
    </html> 
    
    PHP:
    And when i put proper hours and minutes in line: clock = new Clock(17,38);
    it does work, clocks are running, but when i reload page it shows the same time 17,38 and starts running from that time.

    Can someone help me with that code?

    Thank you!
     
    delta3, Jul 17, 2010 IP