Sie sind nicht angemeldet.

fellipe

Schüler

  • »fellipe« ist der Autor dieses Themas

Beiträge: 67

Wohnort: Brazil

Beruf: Photographer

  • Nachricht senden

1

Dienstag, 15. Juni 2010, 01:00

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

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

2

Dienstag, 15. Juni 2010, 01:06

Quellcode

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*

fellipe

Schüler

  • »fellipe« ist der Autor dieses Themas

Beiträge: 67

Wohnort: Brazil

Beruf: Photographer

  • Nachricht senden

3

Dienstag, 15. Juni 2010, 01:09

Quellcode

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

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

4

Dienstag, 15. Juni 2010, 02:31

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

Tuur

5

Dienstag, 15. Juni 2010, 07:18

another way is switching varable

Quellcode

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

Schüler

  • »fellipe« ist der Autor dieses Themas

Beiträge: 67

Wohnort: Brazil

Beruf: Photographer

  • Nachricht senden

6

Mittwoch, 16. Juni 2010, 01:46

my current code is:

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
<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?

7

Mittwoch, 16. Juni 2010, 03:00

Quellcode

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

Mittwoch, 16. Juni 2010, 03:51

I think this should do it:

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
<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

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »pinsane« (16. Juni 2010, 04:23)


fellipe

Schüler

  • »fellipe« ist der Autor dieses Themas

Beiträge: 67

Wohnort: Brazil

Beruf: Photographer

  • Nachricht senden

9

Mittwoch, 16. Juni 2010, 04:18

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

fellipe

Schüler

  • »fellipe« ist der Autor dieses Themas

Beiträge: 67

Wohnort: Brazil

Beruf: Photographer

  • Nachricht senden

10

Mittwoch, 16. Juni 2010, 04:31

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:

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
<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

Schüler

  • »fellipe« ist der Autor dieses Themas

Beiträge: 67

Wohnort: Brazil

Beruf: Photographer

  • Nachricht senden

11

Mittwoch, 16. Juni 2010, 04:37

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

Mittwoch, 16. Juni 2010, 05:18

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

Ähnliche Themen