did you try container.getChildAt(index) e.g. hbox.getChildAt(2) to use your 
example ?

It may of course have other children, and you don't test type in your post, so 
maybe something like :

for (var i=0; i<hbox.numChildren;i++)
{
    if (hbox.getChildAt(i) is coptions)
    {
        hbox.getChildAt(i).visState();
    }
}

would prevent any errors you might be seeing.

but I think adding an event listener to each coptions instance would be a 
nicer, cleaner way to call that method...


-----Original Message-----
From: [email protected] on behalf of Varun Shetty
Sent: Tue 29/01/2008 23:34
To: [EMAIL PROTECTED]; [email protected]
Subject: [flexcoders] Accessing Methods of a Custom Components
 
Hi,

I made a custom component and I am populating an hbox with custom component
using actionscript.

so if 'coptions' is the custom component.. i am doing this

for (var i:int=0;i<10;i++){
var temp:coptions = new coptions();
hbox.addChild(temp);
}


now i can view the custom components within the hbox. but i have a public
function named 'visState' within the custom component "coption".

i want to call them through a button. How do i call them?

i tried calling like this ... hbox.getItemAt(2).visState();

but it didnt work.. i tried many other options... but none worked.. any clue
what should i be doing.. ?

also any insights on how to make global eventdispatchers..?

regards,
Varun


______________________________________________________________________
This communication is from Primal Pictures Ltd., a company registered in 
England and Wales with registration No. 02622298 and registered office: 4th 
Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT 
registration No. 648874577.

This e-mail is confidential and may be privileged. It may be read, copied and 
used only by the intended recipient. If you have received it in error, please 
contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 
1010. Please then delete the e-mail and do not disclose its contents to any 
person.
This email has been scanned for Primal Pictures by the MessageLabs Email 
Security System.
______________________________________________________________________

<<winmail.dat>>

Reply via email to