The position and size of the plugin can by adjusted with the standard layer/plugin attributes.
When no plugin size will be set, the size of the text itself will be used.
For formating the text, a few HTML-tags, simple CSS-styles or BBCode-like tags can be used.
But please note that only a small subset of HTML and CSS is supported by the Flashplayer!
Don't try to use real HTML / CSS code! CSS-classes are not supported!
In the krpano HTML5 Viewer, the textfield plugin is directly integrated into the viewer itself.
The internal HTML5 textfield plugin will be automatically used when trying to load a textfield.swf file.
The HTML / CSS code will be rendered by the Flashplayer (Flash-viewer) or by the Browser (HTML5-viewer)!
The Flashplayer itself supports only a very small subset of HTML4!
For equal results in Flash and HTML5 only very simple html formating code should be used.
Using images inside the html code is not recommended, the Flashplayer was very bad and buggy support here.
When using the < and > characters is not possible (e.g. inside xml attributes),
then the [ and ] characters can be used instead - krpano will convert them automatically.
To escape that conversion to be able to get the [ and ] characters itself,
use them twice as [[ and ]].
There are two possiblites to set the html text:
Either directly in the html attribute:
html="[b]Bold Text[/b]"
Or by referring to a <data> xml element and via data:name:
html="data:htmltext"
It is possible to create links in the html code that can call krpano actions, by using event:actions as link target:
The HTML / CSS code will be rendered by the Flashplayer (Flash-viewer) or by the Browser (HTML5-viewer)!
The Flashplayer itself supports only a very small subset of CSS1!
For equal results in Flash and HTML5 only very simple css styles code should be used.
The usage of CSS classes is not supported
Or by referring to a <data> xml element and via data:name:
css="data:cssstyles"
When setting font-sizes, it is important to use 'px' as entity to get the same results in Flash and HTML5 - and to allow
krpano to scale the font-sizes on mobile devices.
shadow - The shadow value defines the distance of the shadow.
A value of 0.0 disables the shadow. For a 'centered shadow' or 'glowing effects' use very small values like 0.01.
textshadow - The textshadow value defines the distance of the shadow.
A value of 0.0 disables the shadow. For a 'centered shadow' or 'glowing effects' use very small values like 0.01.
This event will be called when automatic sizing (see autowidth and autoheight) will be used and the size of the plugin has changed.
Note - due the automatic word-breaking, there can be more than one onautosized event when the width or the html content will be changed. The number of events can differ between Flash and HTML5.
In Flash its possible to create swf files with embedded fonts.
This makes it possible to use specific fonts, even when they are not installed on the users computers.
For building such swf files, it is necessary to compile a small and simple as3 source code file, where all fonts that
should be embedded are listed.
Here an example for such as3 source code file - embeddedfonts.as.
The textfield plugin itself don't need to be recompiled for using embedded fonts.
A whole full example, including a batch file for automatic compiling the as3 file to a swf file, is included in the Textfield Plugin Sourcecode package.
When the swf file with the embedded fonts is ready, it need to included in the xml as <plugin> with preload=true.
The textfield itself need to select the font and set embeddedfonts=true.
Here an example:
<!-- preload the embedded fonts swf -->
<pluginurl="embeddedfonts.swf" preload="true" devices="flash" />
<!-- the test textfield with 'myFont' and embeddedfonts=true -->
<layername="test"
url="textfield.swf"
align="center"
css="font-family:myFont; font-size:16px;"
html="Test text..."
embeddedfonts="true"padding="10 20"
/>
The whole Actionscript3/Flash source code of the krpano textfield plugin (textfield.as) is here available for free download.
For learning krpano plugin development or for any kind of customization.
Batch files (Windows only) for automatically compiling the plugin source code to a swf file are included in the download package.
Additionally there also sample files for building swf files with embedded fonts.