Alex's email clearly said "IStyleClient" with a capital "I" in front. You'll
also need to import it at the top of your file if FlexBuilder doesn't do it
for you: "import mx.styles.IStyleClient".

Since getChildAt returns a generic DisplayObject, you have to cast it to a
more specific type to be able to call "setStyle". If none of this makes
sense to you, you probably need to do some reading up on the object-oriented
programming concept called polymorphism.

Scott

On Tue, Jul 22, 2008 at 2:34 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> for (var i:int = 0; i < numChildren; i++) {
>
> StyleClient(videoButtonBox.getChildAt(i)).setStyle("backgroundColor","#FF0000")
> }
>
> 1180: Call to a possibly undefined method StyleClient.
>
> Thanks, but I don't get it. Please explain.
>
> Alex Harui wrote:
>  >
>  > It is if you cast everything correctly
>  >
>  >
>  >
>  > IStyleClient(videoButtonBox.getChildAt(i)).setStyle(…).
>  >
>  >
>  >
>  > The compile is trying to help you out so the return types of methods
> and properties are important
>  >
>  >
>  >
>  > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
> On Behalf Of [EMAIL PROTECTED]
>  > Sent: Monday, July 21, 2008 10:14 PM
>  > To: flexcoders@yahoogroups.com
>  > Subject: [flexcoders] accessing styles of children
>  >
>  >
>  >
>  > videoButtonBox. is an VBox with HBoxes for children.
>  > How do I change styles as I iterate thru children?
>  > videoButtonBox.getChildAt(i).setStyle() is not a function.
>  >
>  > var numChildren:Number = videoButtonBox.numChildren;
>  > for (var i:int = 0; i < numChildren; i++) {
>  > videoButtonBox.getChildAt(i)
>  > }
>  >
>  > This page talks about rawChildren as a way to access styles, but I have
>  > read it 10 times and I have no idea what they are trying to describe.
>  >
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>

Reply via email to