You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

mstoss

Intermediate

  • "mstoss" started this thread

Posts: 280

Location: Berlin

  • Send private message

1

Tuesday, January 15th 2019, 4:40pm

if - else again (SOLVED)

Hi,

I'm going nuts with an if condition at the moment.
Whatever I do, only the first part of the if condition is accepted and changing the hotspot(flipspot01).url to different values. The else part is leaving the hotspot[flip01].url unchanged to its original value. Why is this?

Source code

1
2
3
4
5
6
7
8
						if(device.mobile, 
									trace(is mobile);	
									switch(hotspot[flip01].url,stills/flip-big_01.jpg,stills/flip-big_02.jpg,stills/flip-big_03.jpg);
						,
									trace(is other);	
									switch(hotspot[flip01].url,stills/flip-small_01.jpg,stills/flip-small_02.jpg,stills/flip-small_03.jpg);
						);
						trace(hotspot[flip01].url);

All help greatly appreciated, as always...
Michael

This post has been edited 1 times, last edit by "mstoss" (Jan 18th 2019, 1:56pm)


2

Thursday, January 17th 2019, 1:49pm

Hi,

the code itself looks okay, but if the switch action would be working depends on the initial value of the url.

The switch action will lookup the current value in the list of given values and then switch to the next one - but when the current value will be not found in that list, the variable will be kept unchanged.

Best regards,
Klaus

mstoss

Intermediate

  • "mstoss" started this thread

Posts: 280

Location: Berlin

  • Send private message

3

Friday, January 18th 2019, 1:56pm

o-kay...

I deleted the url parameter from the original hotspot to check this out. Where it is still working with one condition and tracing a proper url, it only traces me a "hotspot[].url with the other. So I now copied the hotspot itself to be available in a "devices="desktop" and "devices="mobile" version: and voila, the switch conditions are working for both lines now!
Thank you so much, Klaus!
Yours,
Michael