Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

Understanding FXG files

Understanding FXG files

If you have a fxg file you can use it directly like I have explained in my last post, or you can open it with a text editor to see what code do you have inside it.Let’s take for example this simple fxg file.

If you open it, you will see something like:

<Group ai:artboardActive="1" ai:artboardIndex="0" ai:seqID="1" d:layerType="page" d:pageHeight="201" d:pageWidth="201" d:type="layer" d:userLabel="Artboard 2">
    <Group ai:objID="b883600" ai:seqID="2" d:id="2" d:type="layer" d:userLabel="Layer 1">
      <Rect x="0.5" y="0.5" width="200" height="200" ai:objID="b8c5680" ai:seqID="3">
        <fill>
          <SolidColor color="#FF0000"/>
        </fill>
        <stroke>
          <SolidColorStroke caps="none" joints="miter" miterLimit="10"/>
        </stroke>
      </Rect>
    </Group>
  </Group>

…and so one. This lines, is just what you need. Delete all the “ai” and “d” tags and add spark tag “:s” in every line, you will get something like this:

<s:Group >
                        <s:Group >
                                <s:Rect x="0.5" y="0.5" width="200" height="200">
                                        <s:fill>
                                                <s:SolidColor color="#FF0000"/>
                                        </s:fill>
                                        <s:stroke>
                                                <s:SolidColorStroke caps="none" joints="miter" miterLimit="10"/>
                                        </s:stroke>
                                </s:Rect>
                        </s:Group>
                </s:Group>

In the end you have the same result. You can test it in a application and add the following code:

<s:VGroup horizontalCenter="0">
                        <assets:Square />
               
                <s:Group >
                        <s:Group >
                                <s:Rect x="0.5" y="0.5" width="200" height="200">
                                        <s:fill>
                                                <s:SolidColor color="#FF0000"/>
                                        </s:fill>
                                        <s:stroke>
                                                <s:SolidColorStroke caps="none" joints="miter" miterLimit="10"/>
                                        </s:stroke>
                                </s:Rect>
                        </s:Group>
                </s:Group>
        </s:VGroup>

 

That’s it

Posted on by Fábio Belga This entry was posted in Flex and tagged , . Bookmark the permalink.

Leave a Reply