Change hotspot url using calc

  • Hi there,

    I am trying to change the url of a hotspot in an onOver action, as follows:

    Code
    <action name="hotspot_setupChange_onOver">	
    	set( url, calc( url - '.png' + '_over.png' ) );				
    </action>

    But I get:

    Code
    GET http://192.168.1.5:53087/NaN_over.png 404 (Not Found)

    Can anyone point me in the right direction and explain why my code does not work?

    On a previous project I was successfully using this:

    Code
    <action name="hotspot_setupChange_onOver">	
    	set( url, calc('%SWFPATH%/skin/hotspot_' + linkedscene + '_over.png') );				
    </action>

    Cheers,
    Olly

  • url - '.png'


    Subtracting strings doesn't work.

    I would recommend doing such;
    - provide the different urls already in the xml declaration
    - the path in xml attributes that end with 'url' will get automatically made relative to the xml file in which they are defined
    - this way the paths are automatically correct
    - then just swap the url values

    E.g.

    Code
    <hotspot ...
            url="spot.png"
            overurl="over.png"
            outurl="spot.png"
            onover="copy(url, overurl);"
            onout="copy(url, outurl);"
            />


    Best regards,
    Klaus

  • Thank you - that works.

    Just in case it helps others, I also figured out a way using txtreplace()

    Code
    <action name="hotspot_setupChange_onOver">	
          	txtreplace(newurl, url, '.png', '_over.png');
            set(url, get(newurl));
    </action>

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!