How to call the action using CALL() using variable

  • Hi,

    I am getting the "action call' event in variable.

    set(abc, action1(););

    Now i want to call using get(abc). it will show the right value in trace(get(abc)); but it is not call the action1(); using get command.

    is there way to call the action1() from abc variable.?

    I have tried both call(get(abc)); and call(abc); the way but none of these are working for me. as pet this thread http://www.krpano.com/forum/wbb/inde…d&threadID=5135

    I am calling that event from
    <scene name="scene_pano1" onstart="call(get(abc));">

    I am getting following error in my Safari iPad useragent.
    WARNING: unknown action command: abc

    I have to use this fucntionality on iPhone/iPad.

    thanks

    --
    Pratiks

  • Hi Pratiks,

    First, call(get(abc)); should never work... the correct code is call(abc);

    After trying some on SAFARI, it seems that the call() action does not work on krpanoJS HTML5/iPhone/iPad Viewer...

    Code
    call(trace(helo from call))


    Does not work and returns:

    Code
    INFO: call - unknown function: trace(helo from call)

    Hope it is just a bug as the call() action is really usefull...


    Hi VN2011,

    Imagine you have this:

    Code
    set(i,1);
    txtadd(cmd,'action_',get(i),'()');

    How can you execute the resulting action action_1() ?...

    call(cmd) will do *wink* ...

    SAlut.

    Edited 2 times, last by michel (May 20, 2011 at 6:32 PM).

  • Hi,

    the "call" action is outdated,
    action code or flash functions (or javascript function in HTML5) in variables can be called directly,

    e.g. set a test variable to action code:

    Code
    set(test, trace(hello test));

    call it:

    Code
    test();

    note - but there was bug with the execution order when doing that, this was fixed in the latest krpano 1.0.8.14 release,

    best regards,
    Klaus

  • Hi klaus,

    I have tried following code as per your feedback

    set(test, action1());
    <scene name="scene_pano1" onstart="test();">

    but still it is giving me following error on Safari iPad user agent.
    WARNING: unknown action command: test

    I have to do this because, depend on "test's" value i have to call certain function. and "test's" action value is coming from database.

    Please Klaus

    thanks

  • Hi KLAUS,

    Quote

    action code or flash functions (or javascript function in HTML5) in variables can be called directly

    That is great *smile* ...


    Hi Pratiks,

    I have made a try on SAFARI iPad user agent... And it worked... Perhaps something else in your code?

    SAlut

  • Hi,

    have you written the code exactly in that way: ?

    set(test, action1());
    <scene name="scene_pano1" onstart="test();">

    this wouldn't work,
    the "set(test, action1());" code would need to be inside an action or anywhere else where code will be executed,

    e.g. before the loadscene call:

    Code
    set(test, action1());
    loadscene(scene_pano1);

    best regards,
    Klaus

  • Hi klaus,

    I have written the "set(test, action1());" on start event of KRPano.
    I don't understand exactly, you are trying to say. Please explain me in detail.

    thanks

    --
    Pratiks

  • Hi,

    I have written the "set(test, action1());" on start event of KRPano.

    you mean at

    Code
    <krpano onstart="set(test, action1());">


    ? - in this case it would be okay...

    maybe make sure that onstart is executed by adding a trace call there,
    e.g. when you load the xml from an other pano and have calls after the loadpano call,
    then the onstart is not executed,

    I don't understand exactly, you are trying to say. Please explain me in detail.

    I thought you have written the two lines exactly as posted:

    Code
    set(test, action1());
    <scene name="scene_pano1" onstart="test();">


    the set directly before the <scene> definition,
    and this wouldn't work of course,

    best regards,
    Klaus

Participate now!

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