Solved: flyout hotspot - syntax error?

  • Hello everybody,

    after trying lots of different approaches, i need help:
    what i am trying to do seems simple:

    - i am using the flyout hotspot example
    - i want to add more actions to the same click, which makes the hotspot flying=1

    Code
    onclick="if(flying == 0.0, flyout(), set(plugin[hs-1-text].visible,true), tween(plugin[hs-1-text].alpha,1.0) ); if(flying == 1.0, flyback(), tween(plugin[hs-1-text].alpha,0.0), set(plugin[hs-1-text].visible,false) );"


    this doesnt work. --> anybody knows why?
    - Jan

  • Hi Jan,

    without beeing able to reproduce it (due to lack of time) at the first glance I would suspect some trouble regarding the if syntax

    if( condition, ifaction(), elseaction())... that is the signature of the if-statement expects 2 commatas... your implementation involves more than 2.
    perhaps it may help to collapse yourelse-statements into one single action and call this in the else part (it's also makes things more readable)

    Just a guess

    Greez
    Peter

  • Hi Peter,
    thanks for the quick answer.

    It would be cool to be able to use a bunch of actions from out of the same onclick action, as i this would make things much easier in this case.
    Isnt it possible to trigger several actions when using the if condition?
    - Jan

  • Hi,

    you can put as many actions in an onclick event and also in a if branch as you want,
    but note - an action call ends with ';' - you are trying to use ',' in your example,

    e.g.

    Code
    onclick="dosomething1(); if(test == test2, thenaction1(p1,p2,p3); thenaction2(p1,p2); thenaction3(); , elseaction1(p1,p2); elseaction2(); ); dosomething2();"

    you can also put several if inside each other, you only need to be sure that the opening '(' and closing ')' characters are correct and that the ';' is used to end an action and the ',' to set an new parameter when calling an action,

    best regards,
    Klaus

Participate now!

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