0
votes

I'm not flex expert, I am beginner, so maybe this is not possible.

I have something like :

<s:VGroup gap="2" paddingLeft="1" paddingTop="1">   
                    <s:BorderContainer 
                        rollOver="fadeInBorderComponent.play(); fadeInLabel.play()" 
                        rollOut="fadeOutBorderComponent.play(); fadeOutLabel.play()" 

                        buttonMode="true" useHandCursor="true" 
                        borderColor="0x808080" alpha="0.8" borderWeight="2">                                            
                        <s:Label  width="140" height="60" 
                                 backgroundColor="0xffffff" alpha="0.0" paddingBottom="2" paddingLeft="2" paddingRight="2" paddingTop="4" depth="1" styleName="captionText"
                                 text="Very, very long text to be wrap, long text to be wrap, long text to be wrap, long text to be wrap, long text to be wrap, long text to be wrap, this the end of a text" />
                        <s:Image width="140" height="125" scaleMode="stretch" source="assets/Koala.jpg">                    
                        </s:Image>                      
                    </s:BorderContainer>
                    <s:BorderContainer 
                        rollOver="fadeInBorderComponent.play(); fadeInLabel.play()" 
                        rollOut="fadeOutBorderComponent.play(); fadeOutLabel.play()" 

                        buttonMode="true" useHandCursor="true" 
                        borderColor="0x808080" alpha="0.8" borderWeight="2">                                            
                        <s:Label  width="140" height="60" 
                                 backgroundColor="0xffffff" alpha="0.0" paddingBottom="2" paddingLeft="2" paddingRight="2" paddingTop="4" depth="1" styleName="captionText"
                                 text="Very, very long text to be wrap, long text to be wrap, long text to be wrap, long text to be wrap, long text to be wrap, long text to be wrap, this the end of a text" />
                        <s:Image width="140" height="125" scaleMode="stretch" source="assets/Koala.jpg">                    
                        </s:Image>                      
                    </s:BorderContainer>                    
                </s:VGroup>

And here is my code :

    <s:Fade target="{BorderContainer}" id="fadeInBorderComponent" duration="300" alphaTo="1.0" />                   
    <s:Fade target="{BorderContainer}" id="fadeOutBorderComponent" duration="200" alphaTo="0.8" />      

    <s:Fade target="{Label}" id="fadeInLabel" duration="300" alphaTo="0.8" />                   
    <s:Fade target="{Label}" id="fadeOutLabel" duration="200" alphaTo="0.0" />

My question is, how can I target all BorderContainer that are children of vGroup and not to use ID or array of IDs, is it possible?

Thank you.

1
Why don't you want to use Ids?ethrbunny
@ethrbunny if I have let say 50 BorderContainer controls, or I create them dynamically , than doesn't make sense to use IDs, it would be much better to target it some other way.user147

1 Answers

1
votes

The effect classes have a "targets" array. You can put all your border containers in that array.

for(i=0; i<vgroup.numElements;i++)
{
  yourFade.targets.push(vgroup.getElementAt(i));
}