You are not logged in.

viewinz

Intermediate

  • "viewinz" started this thread

Posts: 145

Location: Wellington, New Zealand

Occupation: Trying to build an entire walkthrough of NZ for tourists

  • Send private message

1

Wednesday, October 21st 2009, 6:01am

continuous panby

I'm trying to create a button the continually pans the map when you hold it down. I can get it to move on every mousedown but if I try and get it to loop and keep moving it just crashes.

Here's what I've tried:

Source code

1
2
3
4
5
6
7
<action name="mapmove">
set(mapmove_off,false);
plugin[map].panby(%1,%2);
if(mapmove_off !=true, mapmove(%1,%2));"
</action>..........

<plugin name="mapnavbut_up" url="%SWFPATH%/assets/buttons/map_nav_but.png" alpha="0" parent="mapnav"  handcursor="true" visible="true" enabled="true" keep="true" align="center" edge="center" x="0"y="-44" ondown="mapmove(0,-1)" onup="set(mapmove_off,true)" onover="set(plugin[mapnavbut_up].alpha,1)" zorder="111" onhover="" onout="set(plugin[mapnavbut_up].alpha,0);set(mapmove_off,true)"/>

2

Wednesday, October 21st 2009, 9:10am

Hi,

it crashes/stops because the "mapmove" action is an endless loop
(during execution no events will be processed and so the "mapmove_off" will be never set)

the flashplayer works in an single-threaded way:
1. execute actionscript code (krpano actions too)
2. then the graphics will be rendered
3. then the events will be catched/processed
4. and then it loops again

see here:
http://onflash.org/ted/2005/07/flash-pla…del-elastic.php

so the action must stop at a time and continue later (in the next processing loop),
this can be done in krpano by using delayedcall(),
e.g.

Source code

1
2
3
4
5
<action name="mapmove">
  set(mapmove_off,false);
  plugin[map].panby(%1,%2);
  delayedcall(0.1, if(mapmove_off !=true, mapmove(%1,%2)); );
</action>


best regards,
Klaus