Benutzerinformationen überspringen
Wohnort: Wellington, New Zealand
Beruf: Trying to build an entire walkthrough of NZ for tourists
|
|
Quellcode |
1 2 3 4 5 6 7 8 |
set(events.onmousedown,checkdrag();set(dragging,on);trace(mousedown)); set(events.onmouseup,set(dragging,off);trace(mouseup)); set(events.onclick,trace(click)); set(dragged,false); <action name="checkdrag"> delayedcall(5, if (dragging == on, set(dragged,done));trace(dragdone),trace(drag not)); </action> |
I'm trying to offer tips on use depending on user interaction, i.e. if a user doesn't click and drag the image give them some tips after a set time.
I'm trying to check to see if a user has clicked and dragged the image basically and set a variable I can check later on.
Any ideas?
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<krpano version="1.0.8" > <events onmousedown="copy(events.orig_onviewchange,events.onviewchange); if(events.onviewchange === null, set(events.onviewchange,set(dragged,true); set(events.onmousedown,null); set(events.onmouseup,null); set(events.onviewchange,null);); , txtadd(events.onviewchange,get(events.onviewchange), ;set(dragged,true); set(events.onmousedown,null); set(events.onmouseup,null); copy(events.onviewchange,events.orig_onviewchange);); );" onmouseup="copy(events.onviewchange,events.orig_onviewchange);" /> <preview type="grid(cube,16,16,512,0xCCCCCC,0x333333,0x999999);" details="16" /> </krpano> |
Benutzerinformationen überspringen
Wohnort: Wellington, New Zealand
Beruf: Trying to build an entire walkthrough of NZ for tourists
|
|
Quellcode |
1 |
WARNING: unknown action command: null;set |
Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.comI'm getting this error onmousedown:
![]()
Quellcode
1 WARNING: unknown action command: null;set
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<krpano version="1.0.8" onstart="delayedcall(2,if (dragged != true,showtext(dude![br] this is an [u]interactive[/u] panorama[br] you can look around by clicking and dragging the mouse,infostyle)));" > <events onmousedown="set(events.onviewchange,set(dragged,true); set(events.onmousedown,null); set(events.onmouseup,null); set(events.onviewchange,null););" onmouseup="set(events.onviewchange,null);" /> <textstyle name="infostyle" origin="center" textalign="center" backgroundcolor="0x000000" fontsize="20" textcolor="0xFFFFFF" bold="false" showtime="2.0" fadetime="1.0" /> <preview type="grid(cube,16,16,512,0xCCCCCC,0x333333,0x999999);" details="16" /> </krpano> |
Dieser Beitrag wurde bereits 4 mal editiert, zuletzt von »pinsane« (14. Mai 2010, 19:39)
First, sorry if I do not explain accurately... I will try to expose not to explain
Zitat
Sorry, my guess is you're using an earlier build of 10.0.8 beta 9 that doesn't support the === (strict comparison) operator...
...|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<krpano version="1.0.8" onstart="showlog(); test();">
<action name="test">
tracing('--- test - 1 ---');
set(events.onviewchange, null);
tracing('--- test - 2 ---');
set(events.onviewchange,);
tracing('--- test - 3 ---');
</action>
<action name="tracing">
trace(%1);
trace('1 - get(events.onviewchange) returns - ',get(events.onviewchange));
if(events.onviewchange === null,
trace('2 - if events.onviewchange === null returns - TRUE')
,
trace('2 - if events.onviewchange === null returns - FALSE')
);
if(events.onviewchange == null,
trace('3 - if events.onviewchange == null returns - TRUE')
,
trace('3 - if events.onviewchange == null returns - FALSE')
);
</action>
</krpano>
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
INFO: krpano 1.0.8.10 (build 2010-05-06) INFO: Flashplayer WIN 10,0,32,18 PlugIn WARNING: not local trusted - ExternalInterface disabled! INFO: --- test - 1 --- INFO: 1 - get(onviewchange) returns - null INFO: 2 - if events.onviewchange === null returns - TRUE INFO: 3 - if events.onviewchange == null returns - FALSE INFO: --- test - 2 --- INFO: 1 - get(onviewchange) returns - null INFO: 2 - if events.onviewchange === null returns - FALSE INFO: 3 - if events.onviewchange == null returns - TRUE INFO: --- test - 3 --- INFO: 1 - get(onviewchange) returns - INFO: 2 - if events.onviewchange === null returns - FALSE INFO: 3 - if events.onviewchange == null returns - FALSE |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<krpano version="1.0.8" > <events onmousedown="copy(events.orig_onviewchange,events.onviewchange); if(events.onviewchange === null, set(events.onviewchange,null)); if(events.onviewchange == null, set(events.onviewchange,set(dragged,true); set(events.onmousedown,null); set(events.onmouseup,null); set(events.onviewchange,null);); , txtadd(events.onviewchange,get(events.onviewchange), ;set(dragged,true); set(events.onmousedown,null); set(events.onmouseup,null); copy(events.onviewchange,events.orig_onviewchange);); );" onmouseup="copy(events.onviewchange,events.orig_onviewchange);" /> <preview type="grid(cube,16,16,512,0xCCCCCC,0x333333,0x999999);" details="16" /> </krpano> |
...Benutzerinformationen überspringen
Wohnort: Wellington, New Zealand
Beruf: Trying to build an entire walkthrough of NZ for tourists
One little thing I'm trying to work out, is the amount (time) of drag. i.e. at the moment it triggers on a little bit of drag, but some users will be able to do that and won't realise they have dragged! So I want to only change the variable when someone has done a good second or more of dragging.
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
<krpano version="1.0.9"
onstart="delayedcall(2,if (dragged != true,showtext(dude![br]this is an [u]interactive[/u] panorama[br]you can look around by clicking and dragging the mouse,infostyle)));" >
<events
clickcount="0"
onmousedown="copy(events.orig_onviewchange,events.onviewchange);
set(events.click1sec,false);
txtadd(events.tmp,'if(events.clickcount LE ',get(events.clickcount),',set(events.click1sec,true););');
delayedcall(1,get(events.tmp));
isvarnull(events.onviewchange);
if(action[isvarnull].return == true,
set(events.onviewchange,
if(events.click1sec == true,
set(dragged,true);
set(events.onmouseup,null);
set(events.onviewchange,null);
set(events.onmousedown,null);
);
);
,
txtadd(events.onviewchange,
get(events.onviewchange),
;if(events.click1sec == true,
set(dragged,true);
set(events.onmouseup,null);
copy(events.onviewchange,events.orig_onviewchange);
set(events.onmousedown,null);
);
);
);"
onmouseup="inc(events.clickcount);copy(events.onviewchange,events.orig_onviewchange);"
/>
<action name="_private_isvarnull">
if('%2' == "'null'",set(%1,true));
</action>
<action name="isvarnull">
set(action[%0].return,false);
_private_isvarnull(action[%0].return,get(%1));
</action>
<textstyle name="infostyle"
origin="center"
textalign="center"
backgroundcolor="0x000000"
fontsize="20"
textcolor="0xFFFFFF"
bold="false"
showtime="2.0"
fadetime="1.0"
/>
<preview type="grid(cube,16,16,512,0xCCCCCC,0x333333,0x999999);" details="16" />
</krpano>
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
<krpano version="1.0.9"
onstart="delayedcall(2,if (dragged != true,showtext(dude![br]this is an [u]interactive[/u] panorama[br]you can look around by clicking and dragging the mouse,infostyle)));" >
<events
onmousedown="copy(events.orig_onviewchange,events.onviewchange);
copy(events.mousedownv,view.vlookat);
copy(events.mousedownh,view.hlookat);
isvarnull(events.onviewchange);
if(action[isvarnull].return == true,
set(events.onviewchange,
sub(events.mousedeltav,view.vlookat,events.mousedownv);
mul(events.mousedeltav,events.mousedeltav,events.mousedeltav);
sub(events.mousedeltah,view.hlookat,events.mousedownh);
mul(events.mousedeltah,events.mousedeltah,events.mousedeltah);
add(events.delta,events.mousedeltav,events.mousedeltah);
if(events.delta GE 100,
set(dragged,true);
set(events.onmouseup,null);
set(events.onviewchange,null);
set(events.onmousedown,null);
);
);
,
txtadd(events.onviewchange,
get(events.onviewchange),
;sub(events.mousedeltav,view.vlookat,events.mousedownv);
mul(events.mousedeltav,events.mousedeltav,events.mousedeltav);
sub(events.mousedeltah,view.hlookat,events.mousedownh);
mul(events.mousedeltah,events.mousedeltah,events.mousedeltah);
add(events.delta,events.mousedeltav,events.mousedeltah);
if(events.delta GE 100,
set(dragged,true);
set(events.onmouseup,null);
copy(events.onviewchange,events.orig_onviewchange);
set(events.onmousedown,null);
);
);
);"
onmouseup="copy(events.onviewchange,events.orig_onviewchange);"
/>
<action name="_private_isvarnull">
if('%2' == "'null'",set(%1,true));
</action>
<action name="isvarnull">
set(action[%0].return,false);
_private_isvarnull(action[%0].return,get(%1));
</action>
<textstyle name="infostyle"
origin="center"
textalign="center"
backgroundcolor="0x000000"
fontsize="20"
textcolor="0xFFFFFF"
bold="false"
showtime="2.0"
fadetime="1.0"
/>
<preview type="grid(cube,16,16,512,0xCCCCCC,0x333333,0x999999);" details="16" />
</krpano>
|
I think the use of === can be confusing..., also compare a value to null...
In relacion to all this, did you remember your request what is the proper way to set a variable to null?![]()
[/code]
|
|
Quellcode |
1 2 3 4 5 6 7 |
<action name="_private_isvarnull">
if('%2' == "'null'",set(%1,true));
</action>
<action name="isvarnull">
set(action[%0].return,false);
_private_isvarnull(action[%0].return,get(%1));
</action>
|
|
|
Quellcode |
1 2 3 4 |
isvarnull(events.onviewchange); if(action[isvarnull].return == true, blah blah blah ); |
About your first example above, perhaps a way to manage better the null comparison could be:
[code if(events.onviewchange === null, set(events.onviewchange,null));
if(events.onviewchange == null,
........snipped............
);"
[/code]
where would one call the graphic of the mouse? i think i see what is going on in there but i dont see what would trigger and call the ouse image.
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »pinsane« (14. Mai 2010, 19:38)
,Very clever and more appropriate solution, as always
Zitat
So for now I use my own null test which I've included in the above example. Here's the relevant code:
![]()
Quellcode
1 2 3 4 5 6 7<action name="_private_isvarnull"> if('%2' == "'null'",set(%1,true)); </action> <action name="isvarnull"> set(action[%0].return,false); _private_isvarnull(action[isvarnull].return,get(%1)); </action>
This code allows me to pass a variable name or node.attribute or array[index].attribute to the action and it "returns"the null status as the attribute action[isvarnull].return. So the usage is:
![]()
Quellcode
1 2 3 4 isvarnull(events.onviewchange); if(action[isvarnull].return == true, blah blah blah );
Thank you for that. This is not so usual as to be noted
...|
|
Quellcode |
1 2 3 4 5 6 7 8 |
<action name="_private_isvarnull">
if('%2' == "'null'",set(%1,true));
</action>
<action name="isvarnull">
set(action[%0].return,false);
_private_isvarnull(action[isvarnull].return,get(%1));
if(%1 == "",set(action[isvarnull].return,true);
</action>
|
...