Could someone explain the "Callwith();" action?

  • I'm having a lot of trouble understanding exactly what the Callwith(); action does, but I have a strong feeling I could make use of it, I've looked through the forum and the documentation and still don't get it, there's not much about it. Any help would be greatly appreciated!

    Alberto.

  • Thank you very much for your prompt response, sachagriffin, as always you are very kind and knowledgeable. I haven't really understood completely, is it something like: hotspot[get(name)].textaction();???

    could you give a specific example of where this could come in handy?

  • Hi,
    no special significance, this function has no
    instead

    Code
    <action name="action1" >
       action2(%1,%2));
    </action>
    <action name="action2" >
       tween(hotspot[%1].alpha, %2);
    </action>

    You can write

    Code
    <action name="action1" >
       callwith(hotspot[%1], action2(%2));
    </action>
    <action name="action2" >
       tween(alpha, %1);
    </action>


    Serge

  • Thank you very much for your prompt response, sachagriffin, as always you are very kind and knowledgeable. I haven't really understood completely, is it something like: hotspot[get(name)].textaction();???

    could you give a specific example of where this could come in handy?


    <hotspot name="box onclick="tween(alpha,0);doawholebunchmore stuff();"

    so if you have another function and you want to tween boxes alpha and doawholebunchmore stuff(), but instead of

    Code
    <action name="test">
    tween(hotspot[box].alpha,0);
    doawholebunchmore stuff();
    </action>

    You could do

    hotspot[box].onclick();

    No no you can't because the alpha has lost its scope.

    so its
    callwith(hotspot[box],onclick);

    plus actions called from layers and hotspots oftentimes use the short cuts [ x, y, name ]etc to do effects. just calling hotspot[box].onclick() wouldn't work correctly unless you replaced all your shortcuts with the full name of the hotspot.

Jetzt mitmachen!

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