I have several Canvases in a VBox, and inside those Canvasses might (or
might not be) one or more dynamically-created TextInputs, which are
displaying fee-amounts in them. When someone clicks on the TextInput and
changes the fee-amount, I want to go through all the TextInput's in that
particular canvas and total up the fees displayed in all the TextInputs in
that Canvas...
Easy enough, right? Set a 'change' event listener and use
Canvas(event.currentTarget.parent).numChildren to loop thru all the children
in that canvas...
Problem I'm having is that I don't know how to tell what type of child I'm
looking at -- like if it's a Label, for example, I just want to ignore it
in that loop. So how do I tell what type of object it is?
Here's an example of my code:
private function feeAmountChanged(event:Event):void {
var totalFees:Number = 0;
var tempCanvas:Canvas = Canvas(event.currentTarget.parent);
for (var i:int=0; i<tempCanvas.numChildren; i++) {
//Here's where I don't know what to do -- how do I say something
like the following:
if (tempCanvas.getChildAt(i) is a TextInput) {
//Do my summing here, adding it to totalFees
}
}
//place the amount contained in totalFees in the appropriate box down
below -- unimportant to this discussion right now
}
I know this is a simple, stupid thing. But I just can't figure it out. LOL
Thanks,
Laurence MacNeill
Mableton, Georgia, USA