我将视频窗口添加到mxml文件中的视频对象
videoMovie = new Video(120,80);
现在可以在某种程度上应用2px的圆形边框吗?
我知道你可以使用
<s:controlBarContent>
<s:Label text="cornerRadius:" />
<s:HSlider id="slider"
minimum="0"
maximum="100"
value="2"
change="slider_change(event);"/>
</s:controlBarContent>
在常规对象上,但无法找到如何使用动态添加的对象:(
答案 0 :(得分:0)
Video对象是一个原生的Flash播放器类 - 而不是Flex类。因此,它不会完成Flex组件可以执行的所有花哨的操作,例如具有边框或cornerRadius样式。
最简单的解决方案是将Video对象包装在具有所需功能的Flex组件中。但你不能简单地做:flexComponent.addChild(videoObject);
你需要做这样的事情:
var video:Video = new Video();
var uiComponent:UIComponent = new UIComponent();
// UIComponent allows you to add non Flex children to it w/addChild()
// but you can't do this w/the Flex container classes (like Group, etc.)
uiComponent.addChild(video);
既然您的Video对象已包装在UIComponent中,您可以将该UIComponent添加到任何Flex容器......
var container:BorderContainer = new BorderContainer();
container.addElement(uiComponent);
// now set your border/corner radius styles...
container.setStyle("cornerRadius", 2);
container.setStyle("borderColor", #FF0000);
这是将非Flex组件(如Video或Sprite)用作Flex组件的子项的常用方法。我相信你可以通过搜索诸如“向Flex组件添加Sprite”之类的短语找到更多相关信息。
干杯!