I love you..!!!

Thanks for the lead.

well since it was a custom component.

I had to use some part of the code from both Tracy and Jim.

so it was something like

var tempOptions:coptions = hbox.getItemAt(2) as coptions;
tempOptions.visState(); // this worked flawlessly after the above line...

here this is what I was trying.
http://www.paranoidart.com/lab/flex/001/index.html
// click on the 'show details' btn.. right click to view the source.

I had another question mebbe, i will post it in a different thread..

regards,
Varun Shetty




On Jan 29, 2008 7:42 PM, Tracy Spratt <[EMAIL PROTECTED]> wrote:

>    Another way is to maintain a reference to each child you instantiate in
> some structure.  An "associative array" (Object) is very handy as it
> simplifies referencing those instances.
>
>
>
> var uicChildOfHB:UIComponent = oDynamicChildArray["myChildIdString"]
>
> Tracy
>
>
>  ------------------------------
>
> *From:* [email protected] [mailto:[EMAIL PROTECTED] *On
> Behalf Of *Jim Hayes
> *Sent:* Tuesday, January 29, 2008 6:59 PM
> *To:* [email protected]
> *Subject:* RE: [flexcoders] Accessing Methods of a Custom Components
>
>
>
> 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] <flexcoders%40yahoogroups.com> on behalf
> of Varun Shetty
> Sent: Tue 29/01/2008 23:34
> To: [EMAIL PROTECTED] <flex_india%40googlegroups.com>;
> [email protected] <flexcoders%40yahoogroups.com>
> 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.
> __________________________________________________________
>   
>

Reply via email to