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?

    Code
    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

    Einmal editiert, zuletzt von mstoss (18. Januar 2019 um 13:56)

  • 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

  • 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

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!