You are not logged in.

bg360

Trainee

  • "bg360" started this thread

Posts: 93

Location: Bulgaria

  • Send private message

1

Wednesday, May 19th 2010, 10:16pm

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

Source code

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

Source code

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

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

2

Thursday, May 20th 2010, 12:11am

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:

Source code

1
switch(plugin[snow].visible)


SAlut.

bg360

Trainee

  • "bg360" started this thread

Posts: 93

Location: Bulgaria

  • Send private message

3

Thursday, May 20th 2010, 7:30am

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:

Source code

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

Thursday, May 20th 2010, 1:18pm

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.

Source code

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


best regards,
Klaus

bg360

Trainee

  • "bg360" started this thread

Posts: 93

Location: Bulgaria

  • Send private message

5

Thursday, May 20th 2010, 2:08pm

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

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