AS3 圆角文本字段
有谁知道如何在 AS3 中创建具有可见边框和圆角的动态文本字段?
我想我可能需要创建一个圆形影片剪辑,调整大小并将其放置在文本后面。
我尝试过这个,但我没有看到任何变化。
var styleRound:StyleSheet = new StyleSheet();
styleRound.parseCSS("h4{cornerRadius:10;borderStyle: solid; borderThickness: 1;}");
tf.htmlText = "<h4>" + hotspotData.caption + "</h4>";
tf.styleSheet = styleRound;
Does anyone know how to create a dynamic textfield with a visible border and rounded corners in AS3?
I think I might have to create a rounded movieclip, resize and place it behind the text.
I tried this, but I don't see any changes.
var styleRound:StyleSheet = new StyleSheet();
styleRound.parseCSS("h4{cornerRadius:10;borderStyle: solid; borderThickness: 1;}");
tf.htmlText = "<h4>" + hotspotData.caption + "</h4>";
tf.styleSheet = styleRound;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
以下是ActionScript 3 中 TextField 的可用 CSS 样式的列表< /a>. 抱歉,没有圆角半径。
您可以在 TextField 对象上打开文本字段的边框 边界属性。 但附近没有可用的房产。
我建议您创建一个新组件,并自行将边框添加为 TextField 下方的 Sprite。 就像是:
Here is a list of the available CSS styles for TextFields in ActionScript 3. Sorry, there is no corner radius.
You can turn on a border for a textfield on the TextField objects border property. But there is not a property available to round the corner.
I suggest you create a new component and add the border yourself as a Sprite underneath the TextField. Something like:
我最终在 Flash 中创建了一个圆角矩形并将其导出为自己的类 - hotspotBG。
I ended up creating a rounded rectangle in flash and exporting it as its own class - hotspotBG.
您无法自行更改文本字段,截至 2014 年,Flash 不允许这样做。
你能做的就是删除背景和边框,
这将使文本字段完全透明,
然后在文本字段后面添加一个图像(矩形工具是最简单的方法),
这样文本字段就位于图像的顶部(z 轴方向),
这可能不是您想到的方式,但它确实有效!
//您正在删除背景和边框
//并用图像替换它们
文本框.背景=假;
textbox.border=false;
You cannot change the text field it self, as of 2014 flash does not allow that.
What you can do is delete the background and the borders,
which will leave the text field completely transparent,
then add an image (rectangle tool is the easiest way to do this) at back of the text field,
so that the text field is on top of the image (z-axis-wise)
It may not be the way you thought of but hell it works!
//you are deleting the background and the borders
//and replacing them with an image
textbox.background=false;
textbox.border=false;
可以只使用CSS样式吗? 比如:
我还没有测试过这个,但这应该会给你一个圆角。
Can you just use the CSS styles? Something like:
I haven't tested this, but that should give you a rounded corner.