Hi,

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

I downloaded swf file: <URL SNIPPED>
but can someone write how to create a code to display that object working on webpage?

Thank you!

almostbob commented: why didnt you write, Stole this swf -1

Recommended Answers

All 6 Replies

swf is not java
swf is not javascript
java is not javascript

swf is ShockWave Flash the best place for basic scripts is adobe.com, the maker

this Q&D page http://www.w3schools.com/flash/flash_inhtml.asp will get you running, the .swf is already made, start at number 4

flash does not work if the plugin is not installed on the user browser, do not depend on the .swf for anything important

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>

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>

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>

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="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>

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?

Thanks.

most clock scripts are 'smart' and will run on system time if the parameters are left blank
try clock = new Clock();

No, with: clock = new Clock(); it also does not work.

I see that one line from swf object has some parameters: hours, minutes and i think there also should be something else put:

<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">

I went to the site,
theft of copyright material is not good
i thought you were having trouble with a script you obtained lawfully
If you did obtain those clocks lawfully, you should have no trouble requesting the site owners assist you with installation
there are clocks you can download from script repositories that dont need to be stolen.

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.
Thanks.

Isn't it obvious? Through new Clock() constructor you are passing initial time. If you do it in static manner giving it 17:38 you always get 17:38. However if you feed constructor with real time data from PHP it will work. Therefore look for way how to obtain hour and minutes from your server and then pass it on the function.

PS: In the future you may want to look for free stuff you can reuse, instead of "borrowing" from other sites...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.