Question

Normally on other IDEs, I simply drag a Rectangle object to the body or content of my application then resize it, define colors, etc. What I discovered in Flex 4 (Flash Builder 4) was that it's not just like that (or is it?) and I can't seem to find something to drag to my application to create a Rectangle object.

My question is, how do I do it? How do I create a simple Rectangle?

Was it helpful?

Solution 2

I think I just figured out how to deal with it. I just make a new component and base it on spark.primitives.Rect. Then after that, I just assign the fill's SolidColor to whatever I need just like my component code below.

<?xml version="1.0" encoding="utf-8"?>
<s:Rect xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" 
        xmlns:mx="library://ns.adobe.com/flex/mx">
    <fx:Script>
        <![CDATA[
            [Bindable]
            public var fillColor:String;
        ]]>
    </fx:Script>
    <s:fill>
        <s:SolidColor color="{fillColor}" />
    </s:fill>
</s:Rect>

Not sure if this is the best way but it works for me so I'll go along with it. :)

OTHER TIPS

There is no support for FXG elements in Flash Builder Design mode. What you can do is, use Flash Catalyst, draw your primitives with it and copy/paste the generated code in Flash Builder.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top