Skip navigation
Currently Being Moderated

FB4 vgroup/hgroup prevents effects from occurring

Mar 15, 2010 2:05 PM

I am using Flash Builder 4 Beta 2 and have run into an issue I can't figure out.  I created a new component that is based on spark.components.Group, Inside that group I define a mx:image and a s:label wrapped in a s:vgroup.  I then have a click handler on the component that will cause the image to bounce up and down when clicked.

 

Very basic example leaving a lot out like the click hanlder and effect stuff, but easily shows what i am talking about:

<s:group>

     <s:vgroup>

          <mx:image />

          <s:label />

     </s:vgroup>

</s:group>

 

Now if i click on the component after its been added to another page the image does not perform the bounce effect.  However if I just change the tags of the vgroup to be the old mx:vbox, that s:vgroup replaced, then the effect works beautifly. 

 

For example:

<s:group>

     <mx:vbox>

          <mx:image />

          <s:label />

     </mx:vbox>

</s:group>

 

What I am wondering is if this is a beta 2 bug or if I am doing something improperly. If i just make the entire thing vgroup instead of just group then the effect doesn't work either.

 
Replies
  • Currently Being Moderated
    Mar 15, 2010 3:31 PM   in reply to RobX82

    Can you please provide a small sample application that demonstrates the issue?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 16, 2010 5:54 AM   in reply to RobX82

    hi,

     

    By using hgroup or vgroup you have enabled contsraints on any children, naturally if an object has imposed constraints trying to animate the object's postion is going to fail.

     

     

    David.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 16, 2010 5:59 AM   in reply to David_F57

    I think his question was really around, why VBox and HBox (which also manage linear layout) work just fine.

     

    -C

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 19, 2010 10:30 PM   in reply to RobX82

    Yes this is a change in how layout works between spark and mx.  If you want to move something taking part in a spark layout you can apply changes to the postLayoutTransformOffsets property of an element. The spark effects make this easy using the applyChangesPostLayout="true" property, for example:

     

    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
             xmlns:s="library://ns.adobe.com/flex/spark" 
             click="seqBounce.play();">
        
        <fx:Declarations>
            <s:Bounce id="bounceEase"/>
            <s:Sequence id="seqBounce"  target="{element1}" >
                <s:Move yBy="-15" duration="400" applyChangesPostLayout="true" />
                <s:Move yBy="15" duration="1000" applyChangesPostLayout="true" easer="{bounceEase}" />
            </s:Sequence>
        </fx:Declarations>
    
        <s:VGroup paddingTop="20" width="100%" height="100%" horizontalAlign="center">
            <s:Button id="element1" label="element1" />
            <s:Button id="element2" label="element2" />
        </s:VGroup>
        
    </s:Application>
    
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points