Change the fontsize of a button's label in Actionscript 3.0

♀尐吖头ヾ 提交于 2020-07-10 03:54:48

问题


Can someone help me change the fontsize of a button's label in actionscript 3? I have a button called "submit" from the components and I was able to change its font using the "setStyle"...But I don't know how to change its fontsize. Is there a code similar to what I have just made? Below is the code on how I change the fontstyle. Any help will be very much appreciated..

submit.label = "Submit";
submit.setStyle("textFormat", new TextFormat("Impact"));

回答1:


The second parameter in the TextFormat constructor is for the font-size:

submit.setStyle("textFormat", new TextFormat("Impact", 24));  //would give a font size of 24 pixels

See the documentation for other parameters such as text alignment, bold, underline etc..



来源:https://stackoverflow.com/questions/25655852/change-the-fontsize-of-a-buttons-label-in-actionscript-3-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!