Sie sind nicht angemeldet.

Tuur

Erleuchteter

  • »Tuur« ist der Autor dieses Themas

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

1

Mittwoch, 16. Juni 2010, 13:23

Time

Is it possible to trace the time of the laptop that is running your tour? So on the one of the user..

if yes, then it will be possible to make a clock that always gives the 'correct time' isn't it?

Can we do that?

Cheers
Tuur *thumbsup*

2

Mittwoch, 16. Juni 2010, 15:22

In my Virtual city tour Feldkirch360 I´v implemented a real-time-clock at the church as you can see here (watch the clock): ;-)

Virtual Panorama Tour Feldkirch360

It´s done via Flash (search at google for time-codes) and implement the swf in krpano as hotspot.

Marc

3

Mittwoch, 16. Juni 2010, 15:25

FPP has a real time clock plugin already. If they can do it we can do it, somehow.

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

4

Mittwoch, 16. Juni 2010, 23:00

Easy, just give me a few secs

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

5

Mittwoch, 16. Juni 2010, 23:47

Ok here's a setup with a digital 12hour clock. Analog clock is possible, but I need to draw the handles and such.

Use plugin[pluginname].gettime to trace the time and getdate to trace the date (untested, but should work fine).
you can alsoo enable/disable the digital clock and date by adding showtime="true/false" showdate="true/false" in the plugin attributes(alsoo untested).

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
import flash.utils.Timer;
import flash.events.TimerEvent;
import krpano_as3_interface;

var krpano : krpano_as3_interface = null;
var pluginpath : String = null;
var pluginobj  : Object = null;
		
var ShowAnalog:Boolean = false;
var ShowDigital:Boolean = true;
var ShowDate:Boolean = true;

var timer:Timer = new Timer(1000);
timer.addEventListener(TimerEvent.TIMER, showClock);

if (stage)
{
	stage.scaleMode = StageScaleMode.NO_SCALE;// no automatic scaling
	stage.align     = StageAlign.TOP_LEFT;// align on top left corner
	timer.start();
}
else
{
	this.addEventListener(Event.ADDED_TO_STAGE, startClock);
	this.addEventListener(Event.REMOVED_FROM_STAGE, stopplugin);
}
function startClock(event:Event)
{
	krpano = krpano_as3_interface.getInstance();
	krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent);

	timer.start();
}
function registerEvent(evt:DataEvent):void
{
	// register event - "data" is the name of the plugin
	pluginpath = evt.data;	
	pluginobj  = krpano.get(pluginpath);
	
	var param:* = null
	
	//<plugin name="clock" showanalog="true/false" showdigital="true/false" showdate="true/false"
	//maybe more options later like font color/size/family
	param = krpano.get(pluginpath + ".showanalog");
	if (param != undefined && param != "")
	ShowAnalog = String( param ).toLowerCase() != "false";
	
	param = krpano.get(pluginpath + ".showdate");
	if (param != undefined && param != "")
	ShowDate = String( param ).toLowerCase() != "false";
		
	param = krpano.get(pluginpath + ".showdigital");
	if (param != undefined && param != "")
	ShowDigital = String( param ).toLowerCase() != "false";
	
	//register functions so you can trace the date/time
	krpano.set(pluginpath+".gettime", krgetTime);
	krpano.set(pluginpath+".getdate", getTime);
	
}
function showClock(event:TimerEvent)
{
	/*
	if(ShowAnalog)
	{
		var time:Date = new Date();	
		var seconds = time.getSeconds();
		var minutes = time.getMinutes();
		var hours = time.getHours();
		//Rotates the pointers on the clock
		//hourMC.rotation = 30 * hours + minutes / 2;
		//minuteMC.rotation = 6 * minutes;
		//secondMC.rotation = 6 * seconds;		
	}*/
	if(ShowDigital)
	{			
		timeTF.text = getTime();			
	}
	if(ShowDate)
	{
		dateTF.text =  getDate();
	}
}
function krgetTime()
{
	krpano.trace(0, "the current time is: " + getTime());
}
function krgetDate()
{
	krpano.trace(0, "the current date is: " + getDate()); 
}
function getTime():String
{
	var time:Date = new Date();
	
	var seconds = time.getSeconds();
	var minutes = time.getMinutes();
	var hours = time.getHours();
	
	if (minutes<10) {
		minutes = "0"+minutes;
	}
	if (seconds<10) {
		seconds = "0"+seconds;
	}
	
	var currenttime:String =  ConvertHour(hours) + ":" + minutes + ":" + seconds;
	return currenttime	
}
function getDate():String
{
	var time:Date = new Date();	
	
	var day:Number = time.getDay();
	var month:Number = time.getMonth();
	var date:Number = time.getDate();		
	var year:Number = time.getFullYear();
	
	var currentdate:String = findDay(day) + " " + findMonth(month) + " " + date + " " + year;
	return currentdate
}
function findDay(day:Number):String
{
	if (day==0){
			return "Sunday"
	} else if (day==1){
			return "Monday"
	} else if (day==2){
			return "Tuesday"
	} else if (day==3){
			return "Wednesday"
	} else if (day==4){
			return "Thursday"
	} else if (day==5){
			return "Friday"
	} else if (day==6){
			return "Saturday"
	}
	return ""
}
function findMonth(month:Number):String
{
	if (month==0){
			return "January"
	} else if (month==1){
			return "February"
	} else if (month==2){
			return "March"
	} else if (month==3){
			return "April"
	} else if (month==4){
			return "May"
	} else if (month==5){
			return "June"
	} else if (month==6){
			return "July"
	} else if (month==7){
			return "August"
	} else if (month==8){
			return "September"
	} else if (month==9){
			return "October"
	} else if (month==10){
			return "November"
	} else if (month==11){
			return "December"
	}
	return ""
}
function ConvertHour(hours:Number):String
{
	//converts 24hours to 12hours notation
	var convertedhours:String;
	if (hours>12 ) 
	{
        convertedhours = String(hours-12);
	}
	if (hours == 0)
	{
		convertedhours = "12";
	}
	return convertedhours
}
function stopplugin(evt:Event)
{
	krpano.removePluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent);
	krpano = null;
	
	timer.removeEventListener(TimerEvent.TIMER, showClock);
}
»Zephyr« hat folgende Datei angehängt:
  • clock.zip (24,12 kB - 118 mal heruntergeladen - zuletzt: Heute, 23:38)

Tuur

Erleuchteter

  • »Tuur« ist der Autor dieses Themas

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

6

Donnerstag, 17. Juni 2010, 00:00

He Zephyr,

Great!!

gonna check that out..

..
*love* *love* *love*

...

Now to try to get it working in the tour...

Master nr. 3 ...

Also for you free drinks in the bar this weekend.. *g*

I hope there are not to much masters here because the bar will be full of 'free' drinkers... *cry*

somebody wanna try to make the analoque one??



Tuur *thumbsup*

7

Donnerstag, 17. Juni 2010, 00:13

Very nice and easy to use. I love that you didn't just show the as3 code but also zipped a package with a swf too for us Flash ignorant users.

Tuur

Erleuchteter

  • »Tuur« ist der Autor dieses Themas

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

8

Donnerstag, 17. Juni 2010, 00:17

....

Oke

i have the plugin like:

<plugin name="clock" url="../plugins/clock.swf" autopos="lefttop,10,10" visible="true" keep="true" alpha="1" scale="1" Parent="STAGE" zorder="101" />


blablablaedit..
EDIT : we don't need that... sorry mis understood..

It works perfect but not with parent ="STAGE"
Is it possible to make that? Zephyr?

...
another edit...

mmm

now it gives: null and minutes and seconds and date ...(no hours )..??
didn't changed a thing..

maybe because it is 01 on the mac.. i put it on 12 hours...
lets have aplay with the .fla file..

...


Thanx

Tuur *thumbsup*

Dieser Beitrag wurde bereits 5 mal editiert, zuletzt von »Tuur« (17. Juni 2010, 01:07)


Tuur

Erleuchteter

  • »Tuur« ist der Autor dieses Themas

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

Tuur

Erleuchteter

  • »Tuur« ist der Autor dieses Themas

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

10

Donnerstag, 17. Juni 2010, 15:26

Ahh

the parent stage..

change in the .fla this:
this.addEventListener(Event.ADDED_TO_STAGE, startClock);

to:
timer.start();

voila!

Thanx Zephyr for teh PM on this.

Tuur *thumbsup*

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

11

Donnerstag, 17. Juni 2010, 22:57

updated it, added a analog clock (showanalog="true" to view it)
added converthours propery (converthours="true") set it on true to do a 12h notation, false if you want 24h notation.

apperently if parent="STAGE" the ADDED_TO_STAGE eventlistener isnt triggered (a bug perhaps klaus?) to temporarily fix it, I started the timer immedietly (although you get a flash error if you the debugger installed, saying the child cant be addressed since it does not exist on stage yet).

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
import flash.utils.Timer;
import flash.events.TimerEvent;
import krpano_as3_interface;

var krpano : krpano_as3_interface = null;
var pluginpath : String = null;
var pluginobj  : Object = null;
		
var ShowAnalog:Boolean = true;
var ShowDigital:Boolean = true;
var ShowDate:Boolean = true;
var ConvertHours:Boolean = false;
var clockMC:Clock = new Clock();
var timer:Timer = new Timer(1000);
timer.addEventListener(TimerEvent.TIMER, showClock);

if (stage)
{
	stage.scaleMode = StageScaleMode.NO_SCALE;// no automatic scaling
	stage.align     = StageAlign.TOP_LEFT;// align on top left corner
	timer.start();
}
else
{
	//this.addEventListener(Event.ADDED_TO_STAGE, startClock);
	timer.start();
	this.addEventListener(Event.REMOVED_FROM_STAGE, stopplugin);
}
function startClock(event:Event)
{
	krpano = krpano_as3_interface.getInstance();
	krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent);

	timer.start();
}
function registerEvent(evt:DataEvent):void
{
	// register event - "data" is the name of the plugin
	pluginpath = evt.data;	
	pluginobj  = krpano.get(pluginpath);
	
	var param:* = null
	
	//<plugin name="clock" showanalog="true/false" showdigital="true/false" showdate="true/false"
	//maybe more options later like font color/size/family
	param = krpano.get(pluginpath + ".showanalog");
	if (param != undefined && param != "")
	ShowAnalog = String( param ).toLowerCase() != "false";
	
	param = krpano.get(pluginpath + ".showdate");
	if (param != undefined && param != "")
	ShowDate = String( param ).toLowerCase() != "false";
		
	param = krpano.get(pluginpath + ".showdigital");
	if (param != undefined && param != "")
	ShowDigital = String( param ).toLowerCase() != "false";
	
	param = krpano.get(pluginpath + ".converthours");
	if (param != undefined && param != "")
	ConvertHours = String( param ).toLowerCase() != "false";
	
	//register functions so you can trace the date/time
	krpano.set(pluginpath+".gettime", krgetTime);
	krpano.set(pluginpath+".getdate", getTime);
	
}
function showClock(event:TimerEvent)
{
	
	if(ShowAnalog)
	{
		var time:Date = new Date();	
		var seconds = time.getSeconds();
		var minutes = time.getMinutes();
		var hours = time.getHours();
		//Rotates the pointers on the clock
		if(!clockMC.parent)
		{
			
			this.addChild(clockMC);
			clockMC.y = timeTF.height + dateTF.height+ 10;
		}
		clockMC.hourMC.rotation = 30 * hours + minutes / 2;
		clockMC.minuteMC.rotation = 6 * minutes;
		clockMC.secondMC.rotation = 6 * seconds;	
		
	}
	if(ShowDigital)
	{			
		timeTF.text = getTime();			
	}
	if(ShowDate)
	{
		dateTF.text =  getDate();
	}
}
function krgetTime()
{
	krpano.trace(0, "the current time is: " + getTime());
}
function krgetDate()
{
	krpano.trace(0, "the current date is: " + getDate()); 
}
function getTime():String
{
	var time:Date = new Date();
	
	var seconds = time.getSeconds();
	var minutes = time.getMinutes();
	var hours = time.getHours();
	
	if (minutes<10) {
		minutes = "0"+minutes;
	}
	if (seconds<10) {
		seconds = "0"+seconds;
	}
	
	var currenttime:String =  ConvertHour(hours) + ":" + minutes + ":" + seconds;
	return currenttime	
}
function getDate():String
{
	var time:Date = new Date();	
	
	var day:Number = time.getDay();
	var month:Number = time.getMonth();
	var date:Number = time.getDate();		
	var year:Number = time.getFullYear();
	
	var currentdate:String = findDay(day) + " " + findMonth(month) + " " + date + " " + year;
	return currentdate
}
function findDay(day:Number):String
{
	if (day==0){
			return "Sunday"
	} else if (day==1){
			return "Monday"
	} else if (day==2){
			return "Tuesday"
	} else if (day==3){
			return "Wednesday"
	} else if (day==4){
			return "Thursday"
	} else if (day==5){
			return "Friday"
	} else if (day==6){
			return "Saturday"
	}
	return ""
}
function findMonth(month:Number):String
{
	if (month==0){
			return "January"
	} else if (month==1){
			return "February"
	} else if (month==2){
			return "March"
	} else if (month==3){
			return "April"
	} else if (month==4){
			return "May"
	} else if (month==5){
			return "June"
	} else if (month==6){
			return "July"
	} else if (month==7){
			return "August"
	} else if (month==8){
			return "September"
	} else if (month==9){
			return "October"
	} else if (month==10){
			return "November"
	} else if (month==11){
			return "December"
	}
	return ""
}
function ConvertHour(hours:Number):Number
{
	//converts 24hours to 12hours notation
	var convertedhours:Number;
	if(ConvertHours)
	{
		if (hours > 12) 
		{
			convertedhours = hours-12;
		}
		if (hours == 0)
		{
			convertedhours = 12;
		}
	}
	else
	{
		convertedhours = hours;
	}
	return convertedhours
}
function stopplugin(evt:Event)
{
	krpano.removePluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent);
	krpano = null;
	
	timer.removeEventListener(TimerEvent.TIMER, showClock);
}


PS the analog clock is ugly, this is to stimulate people to make there own clock + i dont have the time to make it nice ;p You can edit the clock file in the library. just dont alter the instance names of the clockhandlers.
»Zephyr« hat folgende Datei angehängt:
  • clock.zip (27,72 kB - 119 mal heruntergeladen - zuletzt: Heute, 23:38)

Tuur

Erleuchteter

  • »Tuur« ist der Autor dieses Themas

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

13

Dienstag, 5. Oktober 2010, 18:54

Hello,

I downloaded the clock zip file and modified to suit my needs as I only need to display the current date. Thank you for the code on this. Locally it works great as is and will display the date for me but when I upload it to my service provider it doesn't work. I tried with the getdate statement and again locally it works but nothing on the server. Any suggestions?

Below is the coding.

Thanks in advance.


Robert

Zitat

<plugin name="infobar_date" keep="true" style="infobar_style" zorder="1100" visible="true"
alpha="1" align="leftbottom" x="215" y="-20" onloaded="delayedcall(2,show_start_infobar(); action(showdate,date));"
/>
<plugin name="infobar_views" keep="false" style="infobar_style" zorder="1100" visible="true"
html="[p align='right'][font size='14']1,234[/font] views[/p]" alpha="1" align="rightbottom" x="165" y="-20" onloaded="delayedcall(2,show_start_infobar());"
/>

<plugin name="date" url="plugins/clock.swf"
align="leftbottom" x="210" y="0" visible="false"
keep="true"
zorder="1101"
showdate="true"
showtime="false"
selectable="false"
alpha="1"
shadow="5"
autosize="center"
/>

<action name="show_start_infobar">
tween(plugin[infobar_date].y,2,0.5);
tween(plugin[infobar_views].y,4,0.5);
</action>

<action name="showdate">
set(plugin[date].getdate,true);
set(plugin[date].visible,true);
tween(plugin[date].alpha,1);
</action>

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

14

Mittwoch, 6. Oktober 2010, 09:52

Sorry, I've had some stuff disabled apperently in the FLA for testing purposes. Alsoo the getdate/time was badly linked.

plugin property:
showdate="false" or "true" shows the date
showdigital="false" or "true" shows a digital clock
showanalog="false" or "true" Shows the analog clock with the handles
converthours = "false" or "true" Converts 24hour notation to a 12hour notation

plugin functions:
gettime() - for debugging, traces the time in the trace log
getdate() - for debugging, traces the date in the trace log.

Usage example (shows date only):

Quellcode

1
2
3
4
5
6
7
8
<plugin name="date" url="plugins/clock.swf" 
align="leftbottom" x="210" y="0" visible="true"
keep="true"
zorder="100"
showdate="true"
showdigital="false"
selectable="false"
/>
»Zephyr« hat folgende Datei angehängt:
  • clock.zip (24,45 kB - 122 mal heruntergeladen - zuletzt: Heute, 23:38)

Tuur

Erleuchteter

  • »Tuur« ist der Autor dieses Themas

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

16

Mittwoch, 6. Oktober 2010, 16:09

thanks a bunch. I'll work on this later today.