Converting mxml Rect & SolidColor to actionscript
- by touB
I'm trying to learn how to use actionscript over mxml for flexibility. I have this simple block of mxml that I'm trying to convert to actionscript, but I'm stuck half way though
<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>
I can convert the Rect no problem to
private var theRect:Rect = new Rect();
theRect.x = 0;
theRect.y = 50;
theRect.width = "15%";
theRect.height = "15%";
then I'm stuck on the fill. What's the most efficient way to add the SolidColor in as few lines of code as possible.