How to discard a delayedcall event?

  • I would really appreciate a little assistance with this, if someone knows an answer.

    I want to have a pano turn/zoom to a certain location a number of seconds after it loads. I've managed this using delayedcall in the onstart event, like this:

    onstart="action(startview);
    delayedcall(8, action(turnview); );"

    The 'startview' action that's kicked into life by the onstart event shows a particular view location and scale. The 'turnview' action that's invoked 8 seconds afterwards by delayedcall() turns the pano to a different position and scale.

    The reason for having this delayed event is to help make people realise that this is not just a basic photo; to get their attention enough, with luck, for most people to then see the info about clicking and dragging (there's a small note beneath the image) or simply try dragging it themselves.

    HOWEVER - it is actually a bit annoying if you've already started looking around the pano for it to suddenly start turning to a different view point. My ideal solution would be some kind of 'flush events' call that killed off anything that's been set to be pending. Is there anything that can do this?

    Using "oninterrupt( stopall() )" does stop events that are in the immediate queue (such as a consecutive series of tweens) but it doesn't stop a delayedcall event from kicking in later on, even if the 'timer' was started within the interrupted event.

    Does anyone see a way to do this? Or perhaps achieve the same sort of effect in some other way?

    k (fairly new to KRPano but loving it)

  • maybe you could use an "if action"... it came in b4 and can be found here... http://www.krpano.com/forum/wbb/inde…ID=120&pageNo=2 near the bottom.

    check to see if the hlookat or vlookat is still set to the original values... if so, then your trueaction would be to "turnview".

    Your delayed call would reference an action that checked the IF condition... the IF condition would cal the turnview if true... or nothing if false and go on.

    I haven't tested or tried anything using IF... so this is just speculation.

    Graydon

  • Keith,

    This one was a bit of a puzzle, but try this in your krpano.xml file... It works for me using krpano 1.0.7 and I think it does what you're looking for.

    blank10x10.png is just an empty image file with a transparent background that is stretched across the entire krpano instance as a plug-in. As soon as the plug-in is clicked, it disables the autorotate and unloads itself. You need to configure autorotate for your delay and the point to rotate to.

    Hope this helps

    Lee

    ---

    Lee Evans
    levans@cleartours.com

  • Hi,

    an interesting request
    currently there is no direct way to stop a delayedcall(),
    it can be done only via hacks like the one from ClearTours (btw - good idea )

    you could use the same hack also to store a user defined value (e.g. "doturnview")
    in the onclick event, and check this value in the delayedcall action using the if() function,

    e.g.

    best regards,
    Klaus

  • Great bit of script, Klaus! That does the job very well. (And I've also learned a bit more about things as I got it set up, which is always a bonus.)

    I look forward to the possibility of a simpler way to 'flush' a directcall and maybe other things, but in the meantime I'll be testing and implementing this with a big grin on my face.

    Thanks!

    k

  • Thanks again - see how it works at http://www.panoramaphotographer.com/festivals/glad…ingdaytime.html

    As soon as possible (immediate onstart event) it rotates from the equirect center to a starting point with the large tree on the left, then if there's no interaction after 8 seconds it rotates to put the tree trunk on the right.
    This is mainly to show the festival organisers at the moment, in preparation for the Glade 2009 festival. But while doing this I also wanted to explore ways of getting the viewer's attention, showing that it isn't a simple photo but also getting across that it isn't just a video either. I'm not sure this is totally successful, but I think it helps.

    k (rather happy!)

Participate now!

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