Sie sind nicht angemeldet.

1

Dienstag, 15. Januar 2019, 16:40

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?

Quellcode

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

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »mstoss« (18. Januar 2019, 13:56)


2

Donnerstag, 17. Januar 2019, 13:49

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

3

Freitag, 18. Januar 2019, 13:56

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