You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

fellipe

Trainee

  • "fellipe" started this thread

Posts: 67

Location: Brazil

Occupation: Photographer

  • Send private message

1

Tuesday, June 15th 2010, 1:00am

two "onclicks" at the same plugin.

I'm using a code to display the thumbnail list within (parented) with a background and I'd like to show this menu onclick. So far I did it, the problem is when the menu is showing I"d like to hide it onclick. How can I do that? IS possible to have 2 "onclicks"?

The code is:

<plugin
name="menu"
url="images/menu.png"
keep="true"
visible="true"
enabled="true"
handcursor="true"
capture="false"
zorder="1"
alpha="0.70"
blendmode="normal"
smoothing="true"
align="top"
edge="left"
x="0" y="0"
ox="0" oy="-55"
rotate="0"
width="" height=""
scale="1"
scale9grid=""
crop=""
mask=""
onloaded=""
onclick="action(menu_show);"
onhover=""
onout=""
ondown=""
onup=""

/>

/>

<action name="menu_show">
tween(plugin[menu].y,100,distance(700,3),linear);
</action>

<action name="menu_hide">
tween(plugin[menu].y,0,distance(700,3),linear);"
</action>


<plugin name="thumbnails"
url="as3Thumbsforkrpano.swf?TheXML=gallery1.xml"
align="leftttop"
keep="true"
parent="menu"
/>

Tuur

Sage

Posts: 3,288

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

2

Tuesday, June 15th 2010, 1:06am

Source code

1
2
3
4
5
6
7
<plugin name="thumbnails" 
url="as3Thumbsforkrpano.swf?TheXML=gallery1.xml" 
align="leftttop"
keep="true"
parent="menu"
onclick="menu_hide();"
/>


but it's maybe nice to make a close button..

you also have an /> to much after the first plugin.. *attention*

Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

fellipe

Trainee

  • "fellipe" started this thread

Posts: 67

Location: Brazil

Occupation: Photographer

  • Send private message

3

Tuesday, June 15th 2010, 1:09am

Source code

1
2
3
4
5
6
7
<plugin name="thumbnails" 
url="as3Thumbsforkrpano.swf?TheXML=gallery1.xml" 
align="leftttop"
keep="true"
parent="menu"
onclick="menu_hide();"
/>


but it's maybe nice to make a close button..

you also have an /> to much after the first plugin.. *attention*

Tuur *thumbsup*
Fantastic Tuur. It's better than I thought, I mean with your code the menu hides when user select a thumb :)
Thanks

Tuur

Sage

Posts: 3,288

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

4

Tuesday, June 15th 2010, 2:31am

so make a button that does onclick that action to hide..

Tuur
http://www.virtualtuur.com
Skype:studiotuur

mindlessboss

Professional

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

5

Tuesday, June 15th 2010, 7:18am

another way is switching varable

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
...
set(menuvisible,0);
...

<plugin name="btn"
....
onclick="showhide();"
....
/>
<action name="showhide">
   switch(menuvisible,1,0);
   if(menuvisible == 1, ...showAction..., ...hideAction... );
</action>
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

fellipe

Trainee

  • "fellipe" started this thread

Posts: 67

Location: Brazil

Occupation: Photographer

  • Send private message

6

Wednesday, June 16th 2010, 1:46am

my current code is:

Source code

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
<plugin 
		name="menu"
		url="images/menu.png"
		keep="true"
		visible="true"
		enabled="true"
		handcursor="true"
		capture="false"
		zorder="1"
		alpha="1"
		blendmode="normal"
		smoothing="true"
		align="lefttop"
		edge=""
		x="40" y="-158"
		ox="0" oy="0"
		rotate="0"
		width="" height=""
		scale="1"
		scale9grid=""
		crop=""
		mask=""
		onloaded=""
		onclick="action(menu_show)"
		onover=""
		onhover="showtext(Escolha uma cena para ver em 360º, texto)"
		onout="delayedcall(0.0, action(menu_hide); );"
		ondown=""
		onup=""
		
	/>
	
	
<action name="menu_show">
	tween(plugin[menu].y,0,distance(700,4),easeOutBounce);"
</action>

<action name="menu_hide">
	tween(plugin[menu].y,-158,distance(700,3),linear);"
	onclick="menu_hide();"
</action>


What I need to do?

mindlessboss

Professional

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

7

Wednesday, June 16th 2010, 3:00am

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<krpano .... onstart="set(menuvisible,0);">

<plugin 
name="menu"
.... your code here
onclick="menu_showhide();"
.... your code here
/>

<action name="menu_show">
  tween(plugin[menu].y,0,distance(700,4),easeOutBounce);"
</action>

<action name="menu_hide">
  tween(plugin[menu].y,-158,distance(700,3),linear);"
</action>

<action name="menu_showhide">
  switch(menuvisible,1,0);
    if(menuvisible == 1, menu_show(); , menu_hide(); );
</action>
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

8

Wednesday, June 16th 2010, 3:51am

I think this should do it:

Source code

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
<plugin 
		name="menu"
		url="images/menu.png"
		keep="true"
		visible="true"
		enabled="true"
		handcursor="true"
		capture="false"
		zorder="1"
		alpha="1"
		blendmode="normal"
		smoothing="true"
		align="lefttop"
		edge=""
		x="40" y="-158"
		ox="0" oy="0"
		rotate="0"
		width="" height=""
		scale="1"
		scale9grid=""
		crop=""
		mask=""
		onloaded=""
		onhover="showtext(Escolha uma cena para ver em 360º);"
		onclick="action(menu_show)"
		onover="inc(over_menu);"
		onout="txtadd(cmd,'if(over_menu LE ',get(over_menu),',menu_hide();)');delayedcall(2.0,get(cmd));"
		cmd=""
		over_menu="0"
		ondown=""
		onup=""
		
	/>
	
<action name="menu_show">
	tween(plugin[menu].y,0,distance(700,4),easeOutBounce);
	set(onclick,menu_hide());
</action>

<action name="menu_hide">
	tween(plugin[menu].y,-158,distance(700,3),linear);
	set(onclick,menu_show());
</action>

Also, I changed the code for the delayed call so it would close the menu 2 seconds after you leave the menu (but if you return to the menu within two seconds it doesn't close). I think this was what you were asking about in this post

Hope this helps

steve

This post has been edited 1 times, last edit by "pinsane" (Jun 16th 2010, 4:23am)


fellipe

Trainee

  • "fellipe" started this thread

Posts: 67

Location: Brazil

Occupation: Photographer

  • Send private message

9

Wednesday, June 16th 2010, 4:18am

Steve it worked 100%! Thansk a lot for the code :)

fellipe

Trainee

  • "fellipe" started this thread

Posts: 67

Location: Brazil

Occupation: Photographer

  • Send private message

10

Wednesday, June 16th 2010, 4:31am

I just improved the code and now the menu can be open onclick and hide onclick and also it's closed automatically if mouse out, but with a small delayedcall (to avoid "jerky" mouse movement) that is cancelled if mouse over the menu again.

Here's the code, if anyone is interested:

Source code

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
<plugin 
		name="menu"
		url="images/menu.png"
		keep="true"
		visible="true"
		enabled="true"
		handcursor="true"
		capture="false"
		zorder="1"
		alpha="1"
		blendmode="normal"
		smoothing="true"
		align="lefttop"
		edge=""
		x="40" y="-158"
		ox="0" oy="0"
		rotate="0"
		width="" height=""
		scale="1"
		scale9grid=""
		crop=""
		mask=""
		onloaded=""
		onclick="action(menu_show)"
		onover="set(delayedcall,true);"
		onhover="showtext(Escolha uma cena para ver em 360º, texto)"
		onout="set(delayedcall,false); action(menu_auto);"
		ondown=""
		onup=""
		
	/>
	
	
<action name="menu_show">
	tween(plugin[menu].y,0,distance(700,3),linear);
	set(onclick,menu_hide());
</action>

<action name="menu_hide">
	tween(plugin[menu].y,-158,distance(700,3),linear);
	set(onclick,menu_show());
</action>

<action name="menu_auto"> 
delayedcall(0.5,if(delayedcall==false, action(menu_hide)));"
</action>

fellipe

Trainee

  • "fellipe" started this thread

Posts: 67

Location: Brazil

Occupation: Photographer

  • Send private message

11

Wednesday, June 16th 2010, 4:37am

hmm now I see you edited the code above :)
We came to the same solution using different way. This is nice about logical computer language :)

12

Wednesday, June 16th 2010, 5:18am

hmm now I see you edited the code above :)
We came to the same solution using different way. This is nice about logical computer language :)

Nice work Fellipe, things are moving along nicely for you in a very short time.

Regarding the delayedcall, it seemed to me you were trying to add hysteresis to the menu. I think your code does a nice job of "debouncing" the menu, but note that if you continually move over the menu and then out it is possible for an onout event to occur right before one of the previous delayedcall actions fire. If this occurs, the menu will immediately retract, even though the cursor just left the menu. By using an incrementing number rather than a boolean, you can ensure that the desired time passes after the last departure from the menu before it retracts.

Hope that helps

steve

Similar threads