You are not logged in.

esys

Intermediate

  • "esys" started this thread

Posts: 267

Location: Balazé France

Occupation: photographer

  • Send private message

1

Wednesday, March 21st 2012, 6:49pm

Action "if" used with several "devices" ?

Hi,

Last post of the day, promise.

I'd like to give several devices to the action "if", like this

if(isphone|ispad|istablet+flash, set(plugin[...].x, 0); set(plugin[...].y, 0); );

Could that be done?

Thanks. *smile*
Steph
Steph

This post has been edited 2 times, last edit by "esys" (Mar 21st 2012, 8:56pm)


2

Wednesday, March 21st 2012, 7:58pm

I´d like to know that too ;-)

Thx and best regards
Nupsi

3

Wednesday, March 21st 2012, 8:59pm

Hi,

at the moment there is no OR or AND inside an if(),
so it would be necessary to use several ifs to do such check,
but there is also an easy andvery simple solution for this kind of devices check:

first define a global variable, e.g. "mydevicecheck", for that devices situation and set it to true:

Source code

1
<krpano mydevicecheck="true" devices="iphone|ipad|tablet+flash" />


and then just check this variable in the if:

Source code

1
if(mydevicecheck, ...);


best regards,
Klaus

esys

Intermediate

  • "esys" started this thread

Posts: 267

Location: Balazé France

Occupation: photographer

  • Send private message

4

Thursday, March 22nd 2012, 5:11pm

Hi Klaus,

Thanks for your suggestion. Noted! *thumbsup*

Steph.
Steph

5

Friday, March 23rd 2012, 9:13am

Looks very powerfull, Klaus! Could you please explain the "global variable" a little more? Did'nt knew such thing exists *blink*

Thanks and best regards
Nupsi

esys

Intermediate

  • "esys" started this thread

Posts: 267

Location: Balazé France

Occupation: photographer

  • Send private message

6

Friday, March 23rd 2012, 12:02pm

Hi Nupsi,

Global var in this case doesn't mean something special, you create a var that you can use in different ways or with different settings.
It's more understandable with the <events onclick="action();"/> var which is a global one. That means wherever you click the first time in your pano, the action set here will start.

Hope i've been clear enough. *tongue*

Steph.
Steph

7

Saturday, March 24th 2012, 12:47pm

Hi,

I will try to explain too

Quoted

Could you please explain the "global variable" a little more?
sorry, that 'global variable' is a term from programming, here it only means an variable that is globally available/accessible,

e.g. see here - these are the predefined global variables in krpano:
http://krpano.com/docu/actions/#globalvarsreference

defining a custom global variable is possible either by defining it at the <krpano> xml level (which is the 'global scope')...
e.g. either at the root <krpano> node:

Source code

1
2
3
<krpano ... my_global_var="123">
 ...
</krpano>


or anywhere in the xml inside the <krpano> by defining an additionally <krpano> element, e.g.

Source code

1
2
3
4
5
<krpano ...>
  ...
  <krpano my_global_var="123" />
 ...
</krpano>


... or by defining/creating it dynamically by 'setting' it,
e.g. in an action:

Source code

1
set(my_global_var, 123);



on the other side - 'non-global-variables' or 'local variables' in krpano are the variables from an specific object/element, e.g. the attributes from an <plugin> element, e.g. the "name", "width", "height" ... variables from <plugin> element are variables from the given plugin object,

to access an plugin local variable, the 'full path' to it, e.g. "plugin[name].width" need to be used - with only one exception - when the action code is called from an plugin event - then the local variables from this plugin object are directly accessible also without path, e.g. when doing: <plugin ... onclick="tween(width,100);" /> the local "width" variable of the current plugin element will be changed,

best regards,
Klaus

esys

Intermediate

  • "esys" started this thread

Posts: 267

Location: Balazé France

Occupation: photographer

  • Send private message

8

Saturday, March 24th 2012, 5:14pm

Your explanation is infinitely better than mine. *whistling*

Thanks Klaus, i learnt too! *thumbsup*
Steph

mstoss

Intermediate

Posts: 297

Location: Berlin

  • Send private message

9

Thursday, June 7th 2012, 1:14pm

buildthumbs not working in if-clause?

I don't want the thumbnails to be shown on desktop pcs so I tried to use the above variabel/devices combination together with the buildthumbs action, but without success:

Source code

1
2
3
	<krpano mydevicecheck="true" devices="isphone|ispad" />
... 
if(mydevicecheck, buildthumbs(););


Any ideas why?

Yours,
Michael

10

Thursday, June 14th 2012, 10:03am

Hi,

the correct devices names are 'iphone' and 'ipad' (not isphone and ispad),
see here:
http://krpano.com/docu/xml/#devices-notes

e.g. devices="iphone|ipad"

best regards,
Klaus