1 Reply Latest reply on Oct 9, 2009 5:41 PM by Peter deHaan

    <fx:Library> from AS3

    tork314 Level 1

      Hello.

       

      I figured, that it is much easier to draw a shape in fxg (or just import it from let say catalyst), so I did it and put it in the library:

      <fx:Library>

        <fx:Definition name="Separator">

        <s:Rect top="0" bottom="0" width="100%">

      <s:filters>

      <s:BevelFilter angle="120" shadowColor="#dddddd" highlightColor="#111111" distance="1" blurX="2" blurY="2"

      highlightAlpha="0.9"

      shadowAlpha="0.7" type="outer"/>

      </s:filters>

      <s:stroke>

      <s:SolidColorStroke color="#111111"  weight="2" />

      </s:stroke>

      </s:Rect>

        </fx:Definition>

        </fx:Library>

       

      now I would like to use this component from AS3.

       

      this.addElement(new Separator()) doesn't work...

        • 1. Re: <fx:Library> from AS3
          Peter deHaan Level 4

          @tork314,

           

          One of my smarter co-workers offered this solution:

          <fx:Declarations>
              <fx:Component className="MyGroup">
                  <s:Group>
                      <s:Rect width="50" height="50">
                          <s:fill>
                              <mx:SolidColor color="red" />
                          </s:fill>
                      </s:Rect>
                  </s:Group>
              </fx:Component>
          </fx:Declarations>
          

           

           

          Then you'll be able to add it to a group via: group1.addElement(new MyGroup());

           

          Hope that helps,

           

          Peter

          1 person found this helpful