if state malfunctioning? or get me an advice for custom action bcound().

  • The below code is make hotspot bounced.
    But the issue is to pass properties of hotspot set in the action to callWith() action.

    What I want to be is that..
    1. check if hotspot property 'bounceState' is set or not.
    2. not set, then set 'down.
    3. is set as 'down', then set 'up' and callWith() bounce action ifself with the property(bounceState) as set as Number 2.

    The problem is...
    1. I think the properties not passed to callWith() action. What's the solution on this problem?
    2. if statement the following "if(currentBounceState === 'down'," is not working.


    ============ hotspot code ===========

    <hotspot name="pointfinger"
    url="%SWFPATH%/gui/pointfinger.png"
    rotate="180"
    ath="-26"
    atv="0"
    enabled="false"
    onloaded="bounce()"
    zorder="3"
    >
    </hotspot>

    ============== action code =====================

    <action name="bounce">
    copy(hs, hotspot[get(name)]);
    set(bounceRange = 5);

    trace('1 - ',get(hs.bounceState));

    if(get(hs.bounceState) === null,
    set(hs.bounceState, 'down');
    trace('2 - ',get(hs.bounceState));
    );
    copy(currentBounceState, get(hs.bounceState));
    if(currentBounceState === 'down',
    set(hs.bounceState, 'up');
    trace('3 - ',get(hs.bounceState));
    tween(hs.atv, get(hs.atv)-1*get(bounceRange),1,default,callWith(hs, bounce));
    ,
    set(hs.bounceState, 'down');
    tween(hs.atv, get(hs.atv)-1*get(bounceRange),1,default,callWith(hs, bounce));
    trace('4 - ',get(hs.bounceState));
    );
    trace('5 - ',get(hs.bounceState));
    </action>

  • just short... your code is a mess and too complicated! ;)

    this is untested... but its a start...


    read about set(), get() and calc()
    hs is just the name, to address the element you must use hotspot[get(hs)]
    krpano script is not js!

  • Thank you :)
    I didn't think there are such errors in my code. Thank you again.

    However, there's still unsolved issue there.
    Even if I edit the code as you taught, it seems that if statement is not working.

    It's strange.

    Code
    if(get(hs.bounceState) === 'down',	set(hs.bounceState, 'up');		trace('3 - ', hs.bounceState);	tween(hs.atv, calc(hs.atv + bounceRange),1,default,callWith(hs, bounce));,	set(hs.bounceState, 'down');	tween(hs.atv, calc(hs.atv - bounceRange),1,default,callWith(hs, bounce));	trace('4 - ', hs.bounceState);		);
  • just short... your code is a mess and too complicated! ;)

    this is untested... but its a start...


    read about set(), get() and calc()
    hs is just the name, to address the element you must use hotspot[get(hs)]
    krpano script is not js!

    just short... your code is a mess and too complicated! ;)

    this is untested... but its a start...


    read about set(), get() and calc()
    hs is just the name, to address the element you must use hotspot[get(hs)]
    krpano script is not js!

    Thank you!! your seconed edition helps me to the end point.
    I solve it.

    I share the entire code here :)
    It's just not like JS really. There are definitely props :D and cons :(
    Thank you again indexofrefraction.

Participate now!

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