Jump to content
Search Community

Liquid Stage and Display Object that changes size with content

Gary Griswold test
Moderator Tag

Recommended Posts

I am just starting to use LiquidStage and have been able to get it to do most things that I need, but I have buttons placed at the bottom right corner of a DataGrid.  The buttons need to move when the DataGrid changes in height.  This change in height often occurs because the number of rows being displayed changes.

 

I have used a DynamicPinPoint to return the bottom right corner of the data grid, and this works very well when the window is resized, but if the DataGrid content changes the DynamicPinPoint function is not getting called.  Is there something I can do with a resize event when the content in the DataGrid changes?

 

The following is my DynamicPinPoint code:

 

addChild(associateBtns);

var assocCorner:Point = associateGridCorner();

associateBtns.x = assocCorner.x - associateBtns.buttonsWidth;

associateBtns.y = assocCorner.y + 5;

var assocPoint:DynamicPinPoint = new DynamicPinPoint(this, associateGridCorner);

assocPoint.attach(associateBtns);

=======

private function associateGridCorner() : Point {

    var botX:Number = associateGrid.x + associateGrid.width;

    var botY:Number = associateGrid.y + associateGrid.height;

    return(new Point(botX, botY));

}

Link to comment
Share on other sites

The problem that I am describing is not just a DataGrid problem, it would occur anytime there are display objects that change in size as a result of changes of content.  Another example would be a text box whose content changes, so that other display objects just below the text box need to move up or down.

 

The DynamicPinPoint gets the position correct just as soon as one changes the size of the window slightly.  The trick might be to fire an event at the point when the Display Object's size changes in order to get the LiquidStage to recompute positions at that moment.  I see in the LiquidStage code that it uses flash.events.Event.RESIZE, and I was thinking the correct solution might be to dispatch a resize event at the point when a child Display Object has changed size.  But, my trial and error attempts have not yet worked.

 

Is there a way to do this?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...