Sie sind nicht angemeldet.

1

Mittwoch, 19. Mai 2010, 22:16

Snow plugin enable

I want to enable Snow plugin only after click of a button. I can make it initially to be invisible and after that to use

Quellcode

1
switch(plugin[snow].visible)
. But when I put enabled=false to the plugin it still loads and plays. And

Quellcode

1
switch(plugin[snow].enable)
doesn't work.

2

Donnerstag, 20. Mai 2010, 00:11

Hi bg360,

I think you misunderstood the meaning of the enabled attribute:
  • visible
    true or false, default=true
  • enabled
    is plugin enabled to receive mouse events (true or false, default=true)
    NEW in Version 1.0.7:
    when false then mouse events are routed to underlying objects
Enabled to receive mouse events... does not mean enabling the plugin himself...
So, your first approach is the correct way to do:

Quellcode

1
switch(plugin[snow].visible)


SAlut.

3

Donnerstag, 20. Mai 2010, 07:30

Hi bg360,

I think you misunderstood the meaning of the enabled attribute:
  • visible
    true or false, default=true
  • enabled
    is plugin enabled to receive mouse events (true or false, default=true)
    NEW in Version 1.0.7:
    when false then mouse events are routed to underlying objects
Enabled to receive mouse events... does not mean enabling the plugin himself...
So, your first approach is the correct way to do:

Quellcode

1
switch(plugin[snow].visible)


SAlut.
Thanx Michel ! I didn't know that.

Anyway, is there any way to switch the plugin (not only visibility), because it uses much CPU ? I want people to switch snowing only if they want. And I don't want the plugin to use their CPU if they don't want.

4

Donnerstag, 20. Mai 2010, 13:18

Hi,
Anyway, is there any way to switch the plugin (not only visibility), because it uses much CPU ? I want people to switch snowing only if they want. And I don't want the plugin to use their CPU if they don't want.
you could either remove the plugin by calling removeplugin(snow);
or set the number of "flakes" to "0" and visible to "false", then almost no CPU will be used by the plugin,

e.g.

Quellcode

1
2
set(plugin[snow].flakes,0);
set(plugin[snow].visible,false);


best regards,
Klaus

5

Donnerstag, 20. Mai 2010, 14:08

Thanx, Klaus!! It worx.
Here is the code:

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
 <plugin name="snow"
visible="false"
zorder="-5"
url="%SWFPATH%/plugins/snow.swf"
blendmode="normal"
type="snow"
imageurl=""
imagescale="1.0"
flakes="0"
color="0xFFFFFF"
floor="0.3"
speed="1.0"
spreading="4.0"
shake="4.0"
speedvariance="2.0"
rainwidth="0.5"
rainalpha="0.5"
/>


<plugin name="switch_snow"
align="righttop" x="32" y="15" url="snow-button.png"
onclick="switch(plugin[snow].visible);switch(plugin[snow].flakes,0,4000)" />
</krpano>