Something like parent.deleteRow(this) should work.  You could declare
the deleteRow function like this:

//needs fixing for all cases
function deleteRow(child:HBox):Void
{
  if (child == null)
  {
    child = RowArray[Counter-1];
  }
  myHBox.destroyChild(child);
}

Matt

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of rgwilson26
Sent: Thursday, February 09, 2006 8:10 AM
To: [email protected]
Subject: [flexcoders] referencing current object in an array between
components (actionscript 2.0)

In component #1 I have 2 functions that dynamically create an HBox 
and one that deletes an HBox. The HBox that is being createed in 
component #2 with a button that calls the delete function.

My question is how do I send a reference back to the function for 
that particular row that has been created incae the use wants to 
delete that unique HBox row? The add function adds to the end of my 
array of objects, but I need to be able to delete a particular HBox 
within the array of HBox objects.

Code:
*********************************
<mx:Script>
var RowArray : Object = new Array() ;
var Counter : Number = 0 ;
                

private function addRCAParticipantsRow():Void{
RowArray[Counter] = Components.MyHBoxComponent(myHBox.createChild
(Components.MyHBoxComponent));
participantCounter++;
}
                
public function deleteRow():Void{   <---this function should take a 
unique instance from component #2
if(RowArray[Counter] != 0){
myHBox.destroyChild(RowArray[Counter -1] );  <-- destroyChild should 
delete the argument passed into deleteRow()
Counter--;
 }
}
</mx:Script>


<mx:FormItem textAlign="left" id="myHBox">
<mx:HBox>
<mx:TextInput id="txtTitle" width="150"/>
<mx:TextInput id="txtPhoneNumber" width="150"/>         
<mx:Button label="Delete" click="deleteRow()" />
</mx:HBox>
</mx:FormItem>


**********Component #2********************
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox height="25" xmlns:mx="http://www.macromedia.com/2003/mxml";>

<mx:TextInput id="txtTitle1" width="150" text="" />
<mx:TextInput id="txtPhoneNumber1" width="150" text="" />
<mx:Button label="Delete" click="deleteRow();" />
</mx:HBox>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to