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>

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

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

    Quote

    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:

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

    Code
    <data name="title_css">
      title_p{color:#FF0000; font-family:Arial; font-size:14;}
    </data>
  • 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:

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

    Code
    <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=""
    	    	/>
  • 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

    and then...

    cityhall.xml

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

  • 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

    Code
    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

    cityhall.xml

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

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!