Sie sind nicht angemeldet.

1

Montag, 11. Juli 2022, 06:30

Assigning different tasks to the button in different scenes

Hello.
I have a button, keep="true" and different assignments to the click event. I want to keep it true in Scene_1, Scene_2 and Scene_3, keep false in Scene_4', Scene_5 and Scene_6, keep true in Scene_7, Scene_8 and Scene_9 and give the click event a new assignment.
Is there a practical way to do this?

Button of scene 1, scene 2 and scene 3:

Quellcode

1
2
3
4
5
6
7
8
9
10
<plugin name="Link1"
url="%SWFPATH%/ikon/link.png"
keep="true"
enabled="true"
align="leftbottom"	
scale="0.45" 
x="3" y="240"
scale.mobile="0.45" bgalpha="0.20"
visible="true"
onclick="openurl('http://demo1111.com', );"	/> 



Button of scene 7, scene 8 and scene 9:

Quellcode

1
2
3
4
5
6
7
8
9
10
<plugin name="Link1"
url="%SWFPATH%/ikon/link.png"
keep="true"
enabled="true"
align="leftbottom"
scale="0.45"
x="3" y="240"
scale.mobile="0.45" bgalpha="0.20"
visible="true"
onclick="openurl('http://demo2222.com', );" /> 




I'm using the same button names. I place it in the same location.


I want this button to appear in certain scenes and not in certain scenes. I can do this by recreating it within each scene. But I am looking for a more practical method.
I also want to assign different click properties to this button.
Thanks in advance to those who can help.

2

Dienstag, 12. Juli 2022, 22:37

Hi,

Have you tried getting the current scene name?

Quellcode

1
2
3
4
set(currentscene, get(global.xml.scene) );
If(currentscene.name == scene_1,
,
)


if you add an attribute to the scene something like

Quellcode

1
<scene name="scene_1" ... linkedurl="https//demo1111.com"</scene>



you could even define your hotspot like :


Quellcode

1
<hotspot ...onclick="set(currentscene, get(global.xml.scene) ); openurl(get(currentscene.linkedurl));"


(not tried it, just an idea)

3

Mittwoch, 13. Juli 2022, 06:05

Thanks for your answer, I'll try.

4

Freitag, 15. Juli 2022, 05:06

I didn't get results :(

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

5

Freitag, 15. Juli 2022, 11:07

Hi,

another approach could be:

set in each scene a 'tag' or lets call it 'demo':

Quellcode

1
2
3
<scene name="scene_1" ... demo="http://demo1111.com"</scene>
bla bla
<scene name="scene_7" ... demo="http://demo2222.com"</scene>


Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<plugin name="Link1"
url="%SWFPATH%/ikon/link.png"
keep="true"
enabled="true"
align="leftbottom"	
scale="0.45" 
x="3" y="240"
scale.mobile="0.45" bgalpha="0.20"
visible="true"
onclick=""	/> 


<events name="demo" keep="true" onnewscene="DoDemo();" />

<action name="DoDemo">
calc(plugin[Link1].onclick, 'openurl(' + scene[get(xml.scene)].demo + ',_blank);');

</action>


There are more ways of doing this of course.
hope it helps

Tuur
*thumbsup*

6

Freitag, 15. Juli 2022, 21:58

It worked well. Thank you.

I use the same technique in the info button. One fact sheet is valid for several scenes. The information text is too long, writing it separately for each scene makes it longer.
I want an info button to be valid in the cases where I specify it, and invalid in the others. What do you think is the answer to this simple question? :)

7

Freitag, 15. Juli 2022, 23:59

Quellcode

1
2
3
4
5
<action name="DoDemo">
		set(plugin[Link1].visible,true);
		demo='http://demo1111.com'; 
		calc(plugin[Link1].onclick, 'openurl(demo,_blank);');
	</action>

How can I define the variable inside the action?
What is correct coding?

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

8

Samstag, 16. Juli 2022, 01:03

Zitat

How can I define the variable inside the action?

see my previous example.
What you try to do makes no sense to me.

You can do:
<events name="demo" keep="true" onnewscene="DoDemo();" />

and in action
calc(demo, scene[get(xml.scene)].demo);
calc(plugin[Link1].onclick, 'openurl(' + demo + ',_blank);');

but that is the same as:
calc(plugin[Link1].onclick, 'openurl(' + scene[get(xml.scene)].demo + ',_blank);');

Zitat

I use the same technique in the info button. One fact sheet is valid for several scenes. The information text is too long, writing it separately for each scene makes it longer.
I want an info button to be valid in the cases where I specify it, and invalid in the others. What do you think is the answer to this simple question? :)


You can put the text in <data ...

<data name="html_bla">
blablblablablablablabla
</data>

and use the same technic, construct with calc, to pick up the right data.

like: calc(plugin[Link1].html, 'data:html_' + scene[get(xml.scene)].txt);

Tuur *thumbsup*

9

Dienstag, 26. Juli 2022, 13:06

Hi,

another approach could be:

set in each scene a 'tag' or lets call it 'demo':

Quellcode

1
2
3
<scene name="scene_1" ... demo="http://demo1111.com"</scene>
bla bla
<scene name="scene_7" ... demo="http://demo2222.com"</scene>


Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<plugin name="Link1"
url="%SWFPATH%/ikon/link.png"
keep="true"
enabled="true"
align="leftbottom"	
scale="0.45" 
x="3" y="240"
scale.mobile="0.45" bgalpha="0.20"
visible="true"
onclick=""	/> 


<events name="demo" keep="true" onnewscene="DoDemo();" />

<action name="DoDemo">
calc(plugin[Link1].onclick, 'openurl(' + scene[get(xml.scene)].demo + ',_blank);');

</action>


There are more ways of doing this of course.
hope it helps

Tuur
*thumbsup*


How do I define the second variable here?
[code]<scene name="scene_1" ... demo2="scene[get(xml.scene)].name"</scene>


I want to get a stage name. I will use a link to share this scene.
openurl(' + demo1 + demo2 + ',_blank);

Thank you for your help