Whatever the parent of the State_XX buttons are, you can refer to them as
named children of that parent.

So, if it's the current class use the this keyword:

this["State_" + rs[i]].addEventListener(etc...);

If it's another clip, etc, just refer to it by name:

someClipThatHasTheStateButtons["State_" + rs[i]].addEventListener(etc...);

Make sure you've named the instances via the IDE Instance name property or
have explicitly set the name property of the Buttons.


-jonathan





On Sun, Apr 5, 2009 at 8:33 PM, Graham Pearson <gpear...@yourcfpro.com>wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On my flash stage I have 50 buttons all named with the convention of
> State_IN, State_MI, State_WI, etc.
>
> At the present time I have 50 lines like the one line below of:
>
> State_IN.addEventListener(MouseEvent.CLICK, StateButtonClicked);
>
>
> What I am trying to do is when I retrieve the recordset back from the
> coldfusion component is to loop through the results like
>
> function GetClientsWithinCategory_Result(rs.Object) {
> for (var i:int = 0; i < rs.length; i++) {
>  State_rs[i].addEventListener(MouseEvent.CLICK, StateButtonClicked);
>  // The Value of rs[i] will return the 2 letter abriviation of the
> State eg: IN, WI, etc
> }
> }
>
>
> How do I go about combining State_ + the result from rs[i] so that
> when a user clicks on Indiana it will run the actionscript within the
> State Button Clicked Function
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.8 (MingW32)
> Comment: GnuPT 2.6.2.1 by EQUIPMENTE.DE <http://equipmente.de/>
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFJ2U323GqPAgBSy90RAkayAJ95GlmD+MktDr++9Snhl5iSjk9fvACglA8m
> MwJ4iFh/Q6BivYcmxHfPyIw=
> =r37m
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
-jonathan howe
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to