Zunskigraphics
07-09-2008, 05:15 PM
Ok.. Here is the deal....
I have a button...
when you click this button, i want it to remove an HBox and everything inside it..
I thought by giving my HBox an ID, i could say removeChild(idnamehere); but thats not working.. I really need help on this.. not wrapping around the cranium that well! :o
Here is my code.. (it doesn't work)
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import flash.events.Event;
private function removeTest():void
{
addEventListener(MouseEvent.CLICK, removeHbox);
}
private function removeHbox(event:Event):void
{
removeChild.id(myHeadache);
}
]]>
</mx:Script>
<mx:Button id="myBtn" x="34" y="27" label="Click to Remove"/>
<mx:HBox id="myHeadache" x="34" y="57" width="321" height="150" backgroundColor="#804040">
<mx:BarChart id="barchart1" width="292" height="132">
<mx:series>
<mx:BarSeries displayName="Series 1" xField=""/>
</mx:series>
</mx:BarChart>
<mx:Legend dataProvider="{barchart1}"/>
</mx:HBox>
</mx:Application>
I have a button...
when you click this button, i want it to remove an HBox and everything inside it..
I thought by giving my HBox an ID, i could say removeChild(idnamehere); but thats not working.. I really need help on this.. not wrapping around the cranium that well! :o
Here is my code.. (it doesn't work)
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import flash.events.Event;
private function removeTest():void
{
addEventListener(MouseEvent.CLICK, removeHbox);
}
private function removeHbox(event:Event):void
{
removeChild.id(myHeadache);
}
]]>
</mx:Script>
<mx:Button id="myBtn" x="34" y="27" label="Click to Remove"/>
<mx:HBox id="myHeadache" x="34" y="57" width="321" height="150" backgroundColor="#804040">
<mx:BarChart id="barchart1" width="292" height="132">
<mx:series>
<mx:BarSeries displayName="Series 1" xField=""/>
</mx:series>
</mx:BarChart>
<mx:Legend dataProvider="{barchart1}"/>
</mx:HBox>
</mx:Application>