1 Reply Latest reply on Dec 21, 2009 9:39 AM by Ely Greenfield

    FXG library reuse in multiple MXML files

    MikisM87 Level 1

      Hello everyone,

      While playing around with Flex 4 I've come accross FXG reusibility issue.

      Here is what I would like to do. Suppose you have a Library.fxg file which contains the following content:

      <Graphic>

      <Library>

         <Definition name="RedRectagle">...</Definition>

         <Definition name="ComplexShape">..</Definition>

      </Library>

      </Graphic>

      So I wonder if there is a way to include this *.fxg file into *.mxml file somehow and then use those shapes that I've defind in the library as if the library were defined in the *.mxml file itself. For example:

      <?xml version="1.0" encoding="utf-8"?>

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                     xmlns:s="library://ns.adobe.com/flex/spark"

                     xmlns:mx="library://ns.adobe.com/flex/halo"

                     minWidth="800" minHeight="600">


         <!-- Somehow include that *.fxg file here or through defining namespace -->


         <!-- Now use shapes defined in the library -->

         <RedRectangle/>

         <ComplexShape/> 

      </s:Application>

      The only similar *.fxg file inclution procees that I have found is:

      1. Defining XML namespace that points to the package where *.fxg files are located;
      2. Using whole *.fxg file as a single component;

      However this approach does not let you use shapes that are defined in the <Library/> tag and is totally useless if there is only FXG library defined in that *.fxg file and nothing more.

      In addition to that I'd like to know if there is a way to reuse content of one *.fxg file in another *.fxg file.