You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

tylerphotos

Beginner

  • "tylerphotos" started this thread

Posts: 22

Location: Ponca City, OK

Occupation: Photographer, Yoga Instructor

  • Send private message

1

Saturday, July 18th 2009, 7:44pm

XML Limitations in Textfield - Quotation Marks?

Hello there,

How do you get quotes and such to work within the "html=" field of the textfield plugin? I know that "[" and "]" replace "<" and ">", but what replaces quotation marks?

I'm trying to implement some text at the top of my tour that changes depending on the panorama being viewed. For example, if I go to "City Hall" then the text changes from "Virtual Tour" to "City Hall." I've gotten the text to change just fine, but now I want to customize it - make the font white, larger, etc. Whenever I try to add a font color in the "html=" area of the plugin, I get an error "element is malformed". Note: I'm not using the data attribute because I have an action changing the html within the plugin (see below), so the XML limitations are going to apply one way or another.

Here's the relevant data (I spaced the brackets to make them show up):

<plugin name="title" url="%SWFPATH%/plugins/textfield.swf"
align="top center" edge="top" width="250" height="18" x="0" y="-1" children="false"
html="[ b ] Virtual Tour [ / b]"
background="false"
textglow="0"
textglowcolor="0xffffff"
textshadow="0"
autosize="center"
onclick=""
/>

<action name="loadcityhall">
action(s_cityhall);
set(plugin[title].html,[ b ] City Hall [ / b ]);
loadpano(cityhall.xml,null,KEEPALL,BLEND(2));set(krpano.view.fovmin,30);
wait(blend);oninterrupt(action(lookinterrupt));lookto(280,-5,120,smooth(50,25,100));
</action>

VN2009

Professional

Posts: 1,334

Location: Duluth MN

  • Send private message

2

Sunday, July 19th 2009, 2:45am

set(plugin[title].html,([ b ] City Hall [ / b ])); try that it might not work though.

tylerphotos

Beginner

  • "tylerphotos" started this thread

Posts: 22

Location: Ponca City, OK

Occupation: Photographer, Yoga Instructor

  • Send private message

3

Sunday, July 19th 2009, 4:35am

I tried, but enclosing the html in parentheses in the "html=" field didn't help my problem. Thanks for the suggestion, though.

Graydon

Professional

Posts: 614

Location: Texas

Occupation: Industrial gas turbine services.

  • Send private message

4

Sunday, July 19th 2009, 5:37am

reference information here... http://livedocs.adobe.com/flex/201/langr…d.html#htmlText

just below the htmlText section is info on HTML Entities:
&lt; < (less than)
&gt; > (greater than)
&amp; & (ampersand)
&quot; " (double quotes)
&apos; ' (apostrophe, single quote)

I did a quick test on this page... http://www.krpano.com/examples/textfield/

and it looks to work fine.

edit: oops, sorry - read the title and just barely skimmed the actual message... the above doesn't answer all your questions. I'll have to go back and read again *unsure*

Graydon

Professional

Posts: 614

Location: Texas

Occupation: Industrial gas turbine services.

  • Send private message

5

Sunday, July 19th 2009, 6:28am

I played around within the sample linked before and this works...

html="[p][font size=&quot;100&quot;]some text here[/font][/p]"

... when called directly as the html within the plugin.

haven't tested with assigning from an action... but maybe some variant will work.

Also, I'm not sure what you mean by the xml limitations and not using the data node. In you action, you can reset the textfiled plugin's html attribute to a new data source that has the correct title.

Also, when loading a new xml... the data information can be redefined under the same name...

Quoted

when loading a other xml file, all data tags remain unchanged unless they are defined again in the other xml. then they will be overwritten with the new ones.
so each xml could have something like the following:

Source code

1
2
3
<data name="title_data">
    <title_p>this is my title</title_p>
</data>


and with every new xml, the title_data would be replaced...

and by using a custom mark like "title_p" you could define the CSS style you want for all of your titles a single time.

Source code

1
2
3
<data name="title_css">
  title_p{color:#FF0000; font-family:Arial; font-size:14;}
</data>

tylerphotos

Beginner

  • "tylerphotos" started this thread

Posts: 22

Location: Ponca City, OK

Occupation: Photographer, Yoga Instructor

  • Send private message

6

Sunday, July 19th 2009, 6:37pm

Thank you, Graydon! I hadn't considered using the other .xml files for the code.

Unfortunately, I couldn't get the plugin data from the cityhall.xml file to overwrite the one in the main .xml file. Does anything look wrong with the code? *blink*

Relevant data:

Source code

1
2
3
4
5
6
7
<plugin name="title" url="%SWFPATH%/plugins/textfield.swf" 
	    	align="top center" edge="top" width="250" height="18" x="0" y="-1" children="false"
	    	html="[p align=&quot;center&quot;][font size=&quot;12&quot; face=&quot;Verdana&quot; color=&quot;#FFFFFF&quot;]Virtual Tour[/font][/p]"
	    	background="false"
	    	autosize="center"
	    	onclick=""
	    	/>


And within the cityhall.xml file:

Source code

1
2
3
4
5
6
7
	<plugin name="title" url="%SWFPATH%/plugins/textfield.swf" 
	    	align="top center" edge="top" width="250" height="18" x="0" y="-1" children="false"
	    	html="[p align=&quot;center&quot;][font size=&quot;12&quot; face=&quot;Verdana&quot; color=&quot;#FFFFFF&quot;]City Hall[/font][/p]"
	    	background="false"
	    	autosize="center"
	    	onclick=""
	    	/>

This post has been edited 1 times, last edit by "tylerphotos" (Jul 20th 2009, 4:31am)


Graydon

Professional

Posts: 614

Location: Texas

Occupation: Industrial gas turbine services.

  • Send private message

7

Wednesday, July 22nd 2009, 4:32am

when using the keepall flag in your loadpano action it will not load another plugin with the same name.

reference: http://www.krpano.com/docu/actions/#loadpano

Sorry that I wasn't clear... I was suggesting that you define a new data node and use the action to load the new data into the existing textfield plugin.


Like this....

first.xml

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<plugin name="title" url="%SWFPATH%/plugins/textfield.swf" 
    align="top center" edge="top" width="250" height="18" x="0" y="-1" children="false"
    html="data:virtual_tour"
css="title_p{color:#FF0000; font-family:Arial; font-size:14;}"
    background="false"
    autosize="center"
    onclick=""
    />

<data name="virtual_tour">
<title_p>Virtual Tour</title_p>
</data>

<action name="loadcityhall">
 action(s_cityhall);
set(plugin[title].html,data:city_hall);
 loadpano(cityhall.xml,null,KEEPALL,BLEND(2));set(krpano.view.fovmin,30);
 wait(blend);oninterrupt(action(lookinterrupt));lookto(280,-5,120,smooth(50,25,100));
 </action>


and then...

cityhall.xml

Source code

1
2
3
<data name="city_hall">
<title_p>City Hall</title_p>
</data>



When I first got an email about this post being updated... I thought it said you had gotten something like that to work... but the css kept reverting back to standard... I was thinking that by embedding the css into the plugin instead of as another data node that it might work.... but then when I came here to reply that's not what you said... so I'm a bit confused as to what you might have tried and didn't work... so hopefully this isn't redundant to something you tried already *confused*

Let me know how it turns out... If you keep getting stumped I'll work through a demo to see what I can get to work and post a definitive answer.

tylerphotos

Beginner

  • "tylerphotos" started this thread

Posts: 22

Location: Ponca City, OK

Occupation: Photographer, Yoga Instructor

  • Send private message

8

Saturday, July 25th 2009, 7:35pm

Graydon, you have been a wonderful mentor! Thank you for your help with the code.

You were right - I edited my post in between your viewings — I was following your suggestion but had left some old code in there that skewed my results. So what I had originally posted was incorrect because I didn't try your approach. I fixed it.

Anyway, your suggestion was 90% right on! When I placed

Source code

1
set(plugin[title].html,data:city_hall);
where you suggested, it would try to load the new data attribute before it loaded the .xml it was contained in, and gave me an error. To avoid the error, I placed the command in the "onstart" area of the loadpano command.

first.xml

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
<data name="titletext">
		<p align="center">
				<title_p><b>Ponca City Virtual Tour</b></title_p>
		</p>
	</data>
	
	<data name="title_css">
  title_p{color:#FFFFFF; font-family:Verdana; font-size:12;}
</data>
	
	<plugin name="title" url="%SWFPATH%/plugins/textfield.swf" 
	    	align="top center" edge="top" width="250" height="18" x="0" y="-2" children="false"
	    	html="data:titletext"
		css="data:title_css"
	    	background="false"
	    	autosize="center"
	    	onclick=""
	    	/>

 <action name="loadcityhall">
		action(s_cityhall);action(mapsclosebig);
		loadpano(cityhall.xml,null,KEEPALL,BLEND(2),set(plugin[title].html,data:cityhall););set(krpano.view.fovmin,30);
	wait(blend);oninterrupt(action(lookinterrupt));lookto(280,-5,120,smooth(50,25,100));
	</action>


cityhall.xml

Source code

1
2
3
4
5
	<data name="cityhall">
		<p align="center">
				<title_p><b>City Hall</b></title_p>
		</p>
	</data>


Again, thank you so much!!! My tour is vastly better thanks to your willingness to share your knowledge.