Sie sind nicht angemeldet.

1

Donnerstag, 15. November 2012, 09:44

How to scale text when using textfield as screen resizes

Folks,

I would be immensely grateful if someone can see what I am doing wrong please.

I am trying to have text dynamically scale as the screen size is adjusted. I am using an action in the onresize event. Inside the action I check to see if the plugin using the textfield is loaded. If it is, I remove it and then re add it again. The plugin uses a style and the style uses some CSS which has within it the font size set at 15%. However although every works, the plugin does get removed and re added the font size still appears the same on the screen although the screen size has changed.

Any help please.



Nigel

<events onresize=" resetfonts() "/>

<action name="resetfonts">
if(plugin[churchInfobox].loaded, removeplugin(churchInfobox), addplugin(churchInfobox); plugin[churchInfobox].loadstyle(Infoboxplugin); set(plugin[churchInfobox].html, data:churchdata);)
</action>

<style name="Infoboxplugin"

parent="stage"
enabled="true"
visible="true"
autoheight="true"
alpha="0"
bacgroundalpha="0.1"
url="textfield.swf"
scaletext="true"
roundedge="15"
borderwidth="2"
glow="0"
align="topmiddle"
background="true"
keep="true"

x="0" y="2%" width="20%" height="8%"

css="data:cssdata1"
borderwidth="2"
bordercolor="0xffffff"
backgroundcolor="0xCCEBCC"
selectable="false"

children="false"
onover="set(backgroundcolor,0xFFFFFF);tween(glow,10);"
onout="set(backgroundcolor,0xCCEBCC);tween(glow,0);"
/>


<data name="cssdata1">
showtext {
font-family: "Trebuchet MS,Verdana,sans-serif", cursive;
font-size: 15%;
} </data>


<data name="churchdata">
<showtext>Click here for information </showtext>

</data>

2

Donnerstag, 15. November 2012, 10:10

Hi!
maybe I'm wrong, but you can't set font-size with %
just px

so you can recalculate font-size in onresize event action
and set css dynamicaly but with pixels size
Then you no need to remove and add plugin every time the screen size is changed.
just set css

Hope it help
Regards
Andrey *thumbup*
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

3

Donnerstag, 15. November 2012, 12:37

Andrey

Many thanks for the quick response. I am most grateful.

% should work. I have changed them statically within the CSS whilst using Textfield and it does respond to the correct %.

However, I think you have put me onto the right track. It does respond dynamically when px is used, without using remove and add plugin.

I just need to now find some quantity, propably screen height, to base the new px size on as the screen changes size.

Many thanks. *smile* *smile*











Howver I think you may have put me onto the right track. I am now using +