2 Replies Latest reply on Mar 5, 2011 7:13 PM by verner45

    Remove an Element from the Element level...?

    verner45

      i have appliction and a component. i put the component to stage using the addElement(new myComponent());

       

       

      i use vertical layout so you can add the component over and over by clicking the button at the application level.

       

      I just want to be able to delete the components that i choose after adding it so removeElement... tried the this. route not working

      any help is appreciated

       

      Here is the application code:

       

      <?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/mx" minWidth="955" minHeight="600" xmlns:comp="comp.*">
          <fx:Declarations>
              <comp:PhotoButton />
          </fx:Declarations>
         <s:SkinnableContainer x="14" y="108" width="180" height="325" backgroundColor="#CCD9DE">
              <s:Group id="layerGroup" width="180" y="33" >
                  <s:layout>
                      <s:VerticalLayout gap="0" />
                  </s:layout>
              </s:Group>     
          </s:SkinnableContainer>

         <s:Button x="10" y="63" label="Button"
              click="{layerGroup.addElement(new PhotoButton());}"/>

      </s:Application>


      and my component:

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:s="library://ns.adobe.com/flex/spark"
          xmlns:mx="library://ns.adobe.com/flex/mx" width="183" height="33">
          <s:layout>
              <s:HorizontalLayout />
          </s:layout>
          <s:SkinnableContainer backgroundColor="#ffffff">
              <s:Button id="removeBtn" label="X" width="29" x="0" y="0"/>
              <s:Button x="25" y="0" label="layer"/>
          </s:SkinnableContainer>

      </s:Group>