tou*_*ouB 0 apache-flex adobe actionscript mxml
我正在尝试学习如何在mxml上使用actionscript来提高灵活性.我有这个简单的mxml块,我正在尝试转换为actionscript,但是我被困在了一半
<s:Rect id="theRect" x="0" y="50" width="15%" height="15%">
   <s:fill> 
      <s:SolidColor color="black" alpha="0.9" />
   </s:fill>
</s:Rect>
我可以将Rect没有问题转换为
private var theRect:Rect = new Rect();
theRect.x = 0;
theRect.y = 50;
theRect.width = "15%";
theRect.height = "15%";
然后我就陷入了困境.在尽可能少的代码行中添加SolidColor的最有效方法是什么.
这应该工作:
private var theRect:Rect = new Rect();
theRect.x = 0;
theRect.y = 50;
theRect.width = "15%";
theRect.height = "15%";
theRect.fill = new SolidColor(0x000000, 0.9);
MXML(<fill>)中的属性只是Actionscript中的点属性,值是接下来的值,所以它不是太糟糕.
希望有所帮助,兰斯
| 归档时间: | 
 | 
| 查看次数: | 1933 次 | 
| 最近记录: |