Sie sind nicht angemeldet.

1

Samstag, 31. Oktober 2009, 01:04

change text field data source

the below strategy does not work. I cannot find a way to change the text inside the textfield with an onclick event. No matter what I try it only shows whatever the actual plugin loads with. i want to be able to change the text inside the textfield to what data2 has. any ideas?

<data name="data1"> text data 1 </data>
<data name="data2"> text data 2 </data>

<plugin name="text" url="plugins/textfield.swf"
parent="textbox"
zorder="36"
align="lefttop" x="10" y="10"
background="false" borderwidth="0"
html="data:polarbear"
css="p{color:#000000; font-family:Arial; font-size:20;}"
autosize="center"
mask="textmask"
keep="true"
onclick=""
onhover="showtext(Scroll up/down with arrows)"
/>

<action name="changedata">
set(plugin[text].html,data:data2 );
</action>

<plugin name="newdata" alpha="1" zorder="20" keep="true" scale="1" onclick="action(changedata)" />

2

Samstag, 31. Oktober 2009, 01:18

Hi VN2009,

I have not tried ;-) ... But, try with this code:

Quellcode

1
2
3
<action name="changedata">
 set(plugin[text].html, get(data[data2].content) );
 </action>


SAlut.

3

Samstag, 31. Oktober 2009, 15:11

no luck.

EDIT: found the answer. the above does work I found another place in one of my xml's that was overwriting the change after i happened.

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »VN2009« (31. Oktober 2009, 17:38)


4

Samstag, 31. Oktober 2009, 17:51

Hi VN2009,

After some tries, the 2 method are correct....

Quellcode

1
2
set(plugin[text].html,data:data2 );
set(plugin[text].html, get(data[data2].content) );


I have tried your code and for me it seems correct...
So, I have a suggestion:
It seems your code is based on the masked-radar-textfield-hotspot example from Klaus (examples that comes with the Krpano download)... In this example the text has a mask and it can be scrollable... Perhaps, when you make the call to action(changedata) , you have already scrolled the text and then the new text data is hidden by the mask?
Also, I have noticed that, when the html of the textfield pluging is set internally instead of referring to an external data content, then the action(changedata) has no effect *huh* ... Perhaps Klaus would explain more here. *whistling*

Following, a code to demonstrate the exposed above:

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
47
48
49
50
51
52
53
54
55
56
<krpano version="1.0.8" onstart="" >
	
	<preview type="grid(cube,32,32,256,0x000000,0x778899,0x000000);" details="8" />

	<style name="buttonstyle"
	   	url="%SWFPATH%/plugins/textfield.swf" children="false"
	   	width="120" height="20"
	   	css="p{color:#000000; font-family:Arial; font-weight:bold; font-size:14; margin-left:5; margin-right:5; text-align:center; }" 
	   	backgroundcolor="0xFFFFFF" roundedge="5" shadow="1" borderwidth="0" glow="4" glowcolor="0xFFFFFF" 
	   	visible="false" 
	   	onover="tween(alpha,0.7,distance(0.3,0.2));" 
	   	onout="tween(alpha,1.0,distance(0.3,0.2));" 
	   	onloaded="set(alpha,0);set(textblur,15);set(blur,15); set(visible,true); tween(alpha,1,0.3); tween(textblur,0,0.3); tween(blur,0,0.3);"
	   	/>

	<data name="data1">
		<p align="center"> text from data 1 </p>
	</data>
	
	<data name="data2">
		<p align="center"> text from data 2 </p>
	</data>

	<plugin name="text1" url="%SWFPATH%/plugins/textfield.swf"
		align="top" x="10" y="50"
		html="data:data1"
		css="p{color:#000000; font-family:Arial; font-size:20;}"
		autosize="center"
		/>
	<plugin name="text2" url="%SWFPATH%/plugins/textfield.swf"
		align="top" x="10" y="100"
		html="[p align='center'] Salut [/p]"
		css="p{color:#000000; font-family:Arial; font-size:20;}"
		autosize="center"
		/>

	<action name="changedatatext1">
		switch(plugin[text1].html,data:data1,get(data[data2].content));
	</action>
	
	<action name="changedatatext2">
		switch(plugin[text2].html,data:data1,get(data[data2].content));
	</action>

	<plugin name="button_l" keep="true" style="buttonstyle"
	    	html="[p]switch text1[/p]"
	    	align="top" x="-240" y="50" 
	    	onclick="action(changedatatext1)"
	    	/>	
	<plugin name="button_2" keep="true" style="buttonstyle"
	    	html="[p]switch text2[/p]"
	    	align="top" x="-240" y="100"  
	    	onclick="action(changedatatext2)"
	    	/>	
	
</krpano>

The first plugin[text1] changes his content correctly (and the 2 methods to change the content are working too)
The second plugin[text2] does not change.

Salut.

Ähnliche Themen